:root {
    --ink-950: #101828;
    --ink-900: #182230;
    --ink-800: #344054;
    --ink-700: #475467;
    --ink-600: #667085;
    --ink-500: #98a2b3;
    --ink-300: #d0d5dd;
    --ink-200: #e4e7ec;
    --ink-100: #f2f4f7;
    --ink-50: #f9fafb;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --brand-700: #4338ca;
    --brand-600: #4f46e5;
    --brand-500: #6366f1;
    --brand-100: #e0e7ff;
    --brand-50: #eef2ff;
    --cyan-500: #06b6d4;
    --success-600: #039855;
    --success-50: #ecfdf3;
    --warning-600: #dc6803;
    --warning-50: #fffaeb;
    --danger-600: #d92d20;
    --danger-50: #fef3f2;
    --sidebar: #111827;
    --sidebar-soft: #1f2937;
    --border: #e4e7ec;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 10px 30px rgba(16, 24, 40, .08);
    --shadow-lg: 0 24px 64px rgba(16, 24, 40, .14);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    font-family: Vazirmatn, Tahoma, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink-950); background: var(--canvas); font-size: 14px; }
body, button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; transform: none !important; }
::selection { color: #fff; background: var(--brand-600); }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--ink-900);
    background: var(--surface);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder, textarea::placeholder { color: var(--ink-500); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-300); }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}

button {
    border: 0;
    border-radius: var(--radius-md);
    padding: 11px 16px;
    color: var(--ink-800);
    background: var(--ink-100);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

button:hover { transform: translateY(-1px); }
.primary-btn, .dark-button {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    box-shadow: 0 8px 20px rgba(79, 70, 229, .22);
}
.primary-btn:hover, .dark-button:hover { box-shadow: 0 12px 26px rgba(79, 70, 229, .3); }
.danger-btn { color: var(--danger-600); background: var(--danger-50); border: 1px solid #fecdca; }
.danger-btn:hover { background: #fee4e2; }
.light-button { color: var(--ink-800); background: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .65); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; background: transparent; }
.eyebrow { margin: 0 0 6px; color: var(--brand-600); font-size: 12px; font-weight: 800; letter-spacing: -.1px; }
.hidden-by-permission { display: none !important; }

/* Shell */
.shell-grid { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 100vh;
    min-width: 0;
    padding: 22px 16px 18px;
    color: #e5e7eb;
    background:
        radial-gradient(circle at 20% 0, rgba(99, 102, 241, .2), transparent 26%),
        linear-gradient(180deg, #111827 0%, #0b1220 100%);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-head { display: flex; align-items: center; gap: 8px; }
.brand-card { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(145deg, #818cf8, #4f46e5);
    box-shadow: 0 10px 24px rgba(79, 70, 229, .35), inset 0 1px rgba(255, 255, 255, .25);
}
.brand-copy { min-width: 0; display: block; }
.brand-copy strong { display: block; color: #fff; font-size: 15px; direction: ltr; text-align: right; }
.brand-copy small { display: block; margin-top: 4px; color: #98a2b3; font-size: 11px; white-space: nowrap; }
.sidebar-close { display: none; color: #fff; font-size: 25px; }
.sidebar-context {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .045);
}
.context-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50, 213, 131, .12); }
.sidebar-context strong, .sidebar-context small { display: block; }
.sidebar-context strong { color: #f9fafb; font-size: 12px; }
.sidebar-context small { margin-top: 3px; color: #98a2b3; font-size: 10px; }
.nav-stack { display: grid; gap: 3px; overflow-y: auto; overflow-x: hidden; padding-left: 3px; scrollbar-width: thin; scrollbar-color: #344054 transparent; }
.nav-label { padding: 14px 12px 7px; color: #667085; font-size: 10px; font-weight: 800; }
.nav-stack a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 11px;
    color: #aeb7c6;
    font-size: 12px;
    font-weight: 650;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-stack a::after {
    content: "";
    position: absolute;
    right: -16px;
    width: 3px;
    height: 20px;
    border-radius: 3px 0 0 3px;
    background: transparent;
}
.nav-stack a:hover { color: #fff; background: rgba(255, 255, 255, .065); transform: translateX(-2px); }
.nav-stack a.active { color: #fff; background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .08)); }
.nav-stack a.active::after { background: #818cf8; }
.nav-icon, .module-card-icon, .module-hero-icon {
    position: relative;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: currentColor;
    background: rgba(255, 255, 255, .07);
}
.nav-stack a.active .nav-icon { color: #c7d2fe; background: rgba(129, 140, 248, .18); }
.nav-icon::before, .module-card-icon::before, .module-hero-icon::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 1.7px solid currentColor;
    border-radius: 4px;
}
.nav-icon--dashboard::before { border-radius: 3px; box-shadow: 6px 0 0 -4px currentColor, 0 6px 0 -4px currentColor, 6px 6px 0 -4px currentColor; }
.nav-icon--orders::before { border-radius: 2px 2px 5px 5px; transform: rotate(-2deg); }
.nav-icon--payments::before, .nav-icon--payment-gateways::before { width: 15px; height: 10px; border-radius: 3px; box-shadow: inset 0 3px 0 rgba(99, 102, 241, .22); }
.nav-icon--discounts::before { border-radius: 50% 4px 4px 50%; transform: rotate(-45deg); }
.nav-icon--site-pages::before, .nav-icon--site-faqs::before { border-radius: 2px; box-shadow: inset -4px 0 0 rgba(99, 102, 241, .16); }
.nav-icon--site-banners::before { width: 15px; height: 10px; border-radius: 2px; transform: skew(-5deg); }
.nav-icon--low-stock::before { width: 0; height: 0; border: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid currentColor; border-radius: 2px; }
.nav-icon--categories::before { transform: rotate(45deg); border-radius: 3px; }
.nav-icon--visit-analytics::before { width: 15px; height: 12px; border-radius: 2px; box-shadow: inset 3px -5px 0 rgba(99, 102, 241, .28), inset 8px -8px 0 rgba(99, 102, 241, .18); }
.sidebar-footer { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }
.connection-card { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 11px; background: rgba(255, 255, 255, .04); }
.connection-indicator { width: 8px; height: 8px; border-radius: 50%; background: #fdb022; box-shadow: 0 0 0 4px rgba(253, 176, 34, .1); }
.connection-card small, .connection-card strong { display: block; }
.connection-card small { color: #667085; font-size: 9px; }
.connection-card strong { margin-top: 2px; color: #d0d5dd; font-size: 11px; }
.logout-button { display: flex; justify-content: center; align-items: center; gap: 8px; color: #aeb7c6; background: transparent; border: 1px solid rgba(255, 255, 255, .08); }
.logout-button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.logout-icon { width: 13px; height: 13px; border: 1.5px solid currentColor; border-right: 0; border-radius: 3px; }
.sidebar-backdrop { display: none; }

.main-panel { min-width: 0; padding: 0 32px 40px; }
.topbar {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 24px; line-height: 1.35; letter-spacing: -.6px; }
.breadcrumb { margin: 0 0 4px; color: var(--ink-500); font-size: 11px; }
.breadcrumb span { padding: 0 4px; color: var(--ink-300); }
.menu-button { display: none; background: var(--surface); border: 1px solid var(--border); }
.menu-button span { display: block; width: 17px; height: 1.5px; margin: 2px; border-radius: 2px; background: var(--ink-700); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.today-chip, .user-chip { display: flex; align-items: center; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.today-chip { gap: 8px; padding: 10px 13px; border-radius: 12px; color: var(--ink-600); font-size: 11px; }
.calendar-icon { width: 14px; height: 14px; border: 1.5px solid var(--ink-500); border-radius: 3px; box-shadow: inset 0 3px var(--ink-100); }
.user-chip { gap: 10px; min-width: 210px; padding: 8px 10px; border-radius: 14px; }
.user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--brand-700); font-weight: 900; background: var(--brand-50); }
.user-details { min-width: 0; display: block; }
.user-details strong, .user-details small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details strong { font-size: 12px; }
.user-details small { margin-top: 3px; color: var(--ink-500); font-size: 9px; }
.workspace { padding-top: 28px; }

/* Login */
.login-page {
    min-height: 100vh;
    padding: 18px;
    display: grid;
    place-items: center;
    background: #e9edf3;
}
.login-shell {
    width: min(1180px, 100%);
    min-height: min(760px, calc(100vh - 36px));
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 30px;
    background: var(--surface);
    box-shadow: 0 35px 100px rgba(16, 24, 40, .18);
}
.login-showcase {
    position: relative;
    overflow: hidden;
    padding: 46px 52px 34px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 18%, rgba(129, 140, 248, .34), transparent 25%),
        radial-gradient(circle at 80% 85%, rgba(6, 182, 212, .16), transparent 28%),
        linear-gradient(150deg, #111827 0%, #172554 62%, #1e1b4b 100%);
    display: flex;
    flex-direction: column;
}
.login-showcase::before, .login-showcase::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 50%;
}
.login-showcase::before { width: 440px; height: 440px; left: -220px; bottom: -210px; }
.login-showcase::after { width: 280px; height: 280px; left: -130px; bottom: -130px; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { direction: ltr; font-size: 15px; }
.login-brand small { margin-top: 3px; color: #98a2b3; font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase; }
.showcase-copy { position: relative; z-index: 1; margin: auto 0 42px; max-width: 520px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; color: #c7d2fe; background: rgba(255, 255, 255, .055); font-size: 11px; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, .14); }
.showcase-copy h1 { margin: 23px 0 18px; font-size: clamp(37px, 4vw, 55px); line-height: 1.45; letter-spacing: -2px; }
.showcase-copy p { max-width: 470px; margin: 0; color: #b8c2d1; line-height: 2; font-size: 14px; }
.showcase-features { position: relative; z-index: 1; display: grid; gap: 1px; border-radius: 18px; overflow: hidden; background: rgba(255, 255, 255, .07); }
.showcase-features article { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: rgba(255, 255, 255, .035); backdrop-filter: blur(8px); }
.feature-number { color: #818cf8; font-size: 10px; font-weight: 800; }
.showcase-features strong, .showcase-features small { display: block; }
.showcase-features strong { font-size: 11px; }
.showcase-features small { margin-top: 4px; color: #98a2b3; font-size: 9px; }
.showcase-footer { position: relative; z-index: 1; margin: 22px 0 0; color: #667085; direction: ltr; text-align: left; font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 48px clamp(32px, 6vw, 76px); background: #fff; }
.login-panel-inner { width: min(390px, 100%); }
.login-heading { margin-bottom: 30px; }
.login-lock { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 14px; background: var(--brand-50); }
.login-lock::before { content: ""; width: 16px; height: 13px; border: 2px solid var(--brand-600); border-radius: 4px; box-shadow: 0 -8px 0 -4px var(--brand-600); }
.login-heading h2 { margin: 0 0 10px; font-size: 27px; letter-spacing: -.8px; }
.login-heading > p:last-child { margin: 0; color: var(--ink-600); line-height: 1.9; font-size: 12px; }
.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: -12px 0 18px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--ink-50);
}
.login-tabs button {
    padding: 10px 12px;
    border-radius: 999px;
    color: var(--ink-600);
    background: transparent;
    font-size: 11px;
    font-weight: 800;
}
.login-tabs button.active {
    color: var(--brand-700);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.login-form { display: grid; gap: 11px; }
.login-form--mode { display: none; }
.login-form--mode.active { display: grid; }
.login-form > label { color: var(--ink-700); font-size: 11px; font-weight: 700; }
.input-shell { position: relative; }
.input-shell input { height: 49px; padding-right: 44px; direction: ltr; text-align: right; }
.input-shell--code input { text-align: center; letter-spacing: 8px; font-size: 18px; }
.input-icon { position: absolute; z-index: 1; right: 15px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); opacity: .75; }
.input-icon--phone { border: 1.5px solid var(--ink-500); border-radius: 3px; }
.input-icon--key { border: 1.5px solid var(--ink-500); border-radius: 50%; }
.input-icon--key::after { content: ""; position: absolute; left: -6px; top: 6px; width: 8px; border-top: 1.5px solid var(--ink-500); }
.secondary-action, .login-submit { height: 49px; display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; }
.secondary-action { margin: 2px 0 9px; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); }
.button-arrow { font-size: 18px; line-height: 1; }
.form-help { margin: 4px 0 0; color: var(--ink-600); line-height: 1.8; font-size: 11px; }
.security-note { display: flex; align-items: center; gap: 11px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.shield-icon { width: 26px; height: 29px; border: 1.5px solid var(--success-600); border-radius: 13px 13px 9px 9px; background: var(--success-50); }
.security-note p { margin: 0; }
.security-note strong, .security-note small { display: block; }
.security-note strong { color: var(--ink-700); font-size: 10px; }
.security-note small { margin-top: 3px; color: var(--ink-500); font-size: 9px; }

/* Dashboard */
.dashboard-page, .management-page { display: grid; gap: 26px; }
.dashboard-hero {
    position: relative;
    overflow: hidden;
    min-height: 300px;
    display: grid;
    grid-template-columns: 1.45fr .65fr;
    align-items: center;
    gap: 40px;
    padding: 38px 42px;
    border-radius: var(--radius-xl);
    color: #fff;
    background:
        radial-gradient(circle at 18% 5%, rgba(129, 140, 248, .3), transparent 23%),
        linear-gradient(130deg, #111827, #1e1b4b 64%, #312e81);
    box-shadow: var(--shadow-lg);
}
.dashboard-hero::after { content: ""; position: absolute; width: 330px; height: 330px; left: -170px; bottom: -235px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255, 255, 255, .025); }
.hero-copy, .report-control { position: relative; z-index: 1; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; color: #c7d2fe; font-size: 11px; font-weight: 800; }
.hero-kicker span { width: 22px; border-top: 2px solid #818cf8; }
.hero-copy h2 { margin: 18px 0 13px; font-size: clamp(31px, 3.2vw, 45px); line-height: 1.45; letter-spacing: -1.6px; }
.hero-copy > p { max-width: 650px; margin: 0; color: #b8c2d1; line-height: 2; font-size: 13px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 25px; color: #98a2b3; font-size: 10px; }
.hero-meta span { display: flex; align-items: center; gap: 7px; }
.meta-icon { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50, 213, 131, .1); }
.meta-icon--secure { background: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, .1); }
.report-control { padding: 21px; border: 1px solid rgba(255, 255, 255, .11); border-radius: 20px; background: rgba(255, 255, 255, .07); backdrop-filter: blur(14px); }
.report-control-head { display: flex; align-items: center; gap: 11px; margin-bottom: 17px; padding-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.control-icon { width: 34px; height: 34px; display: block; border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; box-shadow: inset 0 -10px rgba(129, 140, 248, .12); }
.report-control-head small, .report-control-head strong { display: block; }
.report-control-head small { color: #98a2b3; font-size: 9px; }
.report-control-head strong { margin-top: 3px; font-size: 12px; }
.report-control > label { display: block; margin-bottom: 7px; color: #b8c2d1; font-size: 10px; }
.report-control select { color: #fff; background: rgba(17, 24, 39, .55); border-color: rgba(255, 255, 255, .12); }
.report-control select option { color: var(--ink-900); background: #fff; }
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.report-actions button { padding: 10px; font-size: 10px; }
.section-block { display: grid; gap: 15px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-title h3 { margin: 0; font-size: 18px; }
.section-note { color: var(--ink-500); font-size: 10px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card, .panel-card, .module-card, .toolbar-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.kpi-card { position: relative; overflow: hidden; padding: 19px; }
.kpi-card::after { content: ""; position: absolute; left: -26px; top: -26px; width: 74px; height: 74px; border-radius: 50%; background: var(--accent-soft); }
.kpi-card--revenue { --accent: #4f46e5; --accent-soft: #eef2ff; }
.kpi-card--orders { --accent: #0891b2; --accent-soft: #ecfeff; }
.kpi-card--payments { --accent: #dc6803; --accent-soft: #fffaeb; }
.kpi-card--stock { --accent: #d92d20; --accent-soft: #fef3f2; }
.kpi-head { display: flex; align-items: center; gap: 9px; }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); }
.kpi-icon::before { content: ""; width: 13px; height: 13px; border: 1.7px solid var(--accent); border-radius: 4px; }
.kpi-label { color: var(--ink-700); font-size: 11px; font-weight: 750; }
.kpi-card > strong { display: block; margin: 18px 0 7px; font-size: clamp(22px, 2vw, 30px); line-height: 1.25; letter-spacing: -.8px; }
.kpi-card > small { color: var(--ink-500); font-size: 9px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 14px; }
.panel-card { min-width: 0; padding: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-badge, .count-badge { padding: 6px 9px; border-radius: 999px; color: var(--brand-700); background: var(--brand-50); font-size: 9px; font-weight: 750; }
.panel-badge--blue { color: #0e7090; background: #ecfdff; }
.chart-wrap { position: relative; height: 260px; overflow: hidden; border-radius: var(--radius-md); background: linear-gradient(180deg, var(--ink-50), #fff); }
.chart-wrap canvas { width: 100%; height: 100%; }
.modules-section { padding-bottom: 14px; }
.module-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.module-card { position: relative; min-height: 165px; padding: 17px; display: flex; flex-direction: column; align-items: flex-start; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.module-card:hover { transform: translateY(-3px); border-color: #c7d2fe; box-shadow: var(--shadow-md); }
.module-card-icon { width: 38px; height: 38px; flex-basis: 38px; color: var(--brand-600); background: var(--brand-50); }
.module-card-copy { display: block; margin-top: 15px; }
.module-card-copy strong, .module-card-copy small { display: block; }
.module-card-copy strong { font-size: 12px; }
.module-card-copy small { margin-top: 7px; color: var(--ink-500); line-height: 1.7; font-size: 9px; }
.module-arrow { position: absolute; left: 15px; top: 17px; color: var(--ink-300); font-size: 17px; transition: color .2s ease, transform .2s ease; }
.module-card:hover .module-arrow { color: var(--brand-600); transform: translateX(-3px); }

/* Management */
.module-hero {
    min-height: 154px;
    padding: 27px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    border: 1px solid #dfe3ff;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 88% 20%, rgba(99, 102, 241, .11), transparent 25%),
        linear-gradient(135deg, #fff, #f8f9ff);
}
.module-hero-main { display: flex; align-items: center; gap: 19px; }
.module-hero-icon { width: 58px; height: 58px; flex-basis: 58px; color: #fff; border-radius: 17px; background: linear-gradient(145deg, var(--brand-500), var(--brand-700)); box-shadow: 0 13px 28px rgba(79, 70, 229, .24); }
.module-hero-icon::before { width: 20px; height: 20px; }
.module-hero h2 { margin: 0 0 6px; font-size: 26px; }
.module-hero-main p:last-child { margin: 0; color: var(--ink-600); line-height: 1.8; font-size: 11px; }
.permission-chip { display: flex; align-items: center; gap: 10px; min-width: 235px; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255, 255, 255, .8); }
.permission-icon { width: 29px; height: 29px; border: 1.5px solid var(--success-600); border-radius: 50%; background: var(--success-50); }
.permission-chip small, .permission-chip strong { display: block; }
.permission-chip small { color: var(--ink-500); font-size: 9px; }
.permission-chip strong { margin-top: 3px; color: var(--ink-700); direction: ltr; text-align: right; font-size: 10px; }
.toolbar-card { padding: 12px; display: flex; align-items: center; gap: 12px; }
.search-box { position: relative; flex: 1; }
.search-box input { height: 43px; padding-right: 42px; background: var(--ink-50); }
.search-icon { position: absolute; z-index: 1; right: 15px; top: 14px; width: 13px; height: 13px; border: 1.5px solid var(--ink-500); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; left: -5px; bottom: -3px; width: 6px; border-top: 1.5px solid var(--ink-500); transform: rotate(-45deg); }
.toolbar-actions { display: flex; gap: 8px; }
.tool-button { display: flex; align-items: center; gap: 7px; color: var(--ink-700); background: #fff; border: 1px solid var(--border); font-size: 10px; }
.toolbar-actions .primary-btn { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.refresh-icon, .export-icon, .plus-icon { width: 12px; height: 12px; display: inline-block; border: 1.5px solid currentColor; border-radius: 50%; }
.export-icon { border-radius: 2px; border-top: 0; }
.plus-icon { position: relative; border: 0; }
.plus-icon::before, .plus-icon::after { content: ""; position: absolute; top: 5px; left: 0; width: 12px; border-top: 1.5px solid currentColor; }
.plus-icon::after { transform: rotate(90deg); }
.split-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(340px, .68fr); gap: 14px; align-items: start; }
.records-panel { padding: 0; overflow: hidden; }
.records-header { margin: 0; padding: 19px 20px 15px; }
.table-wrap { max-height: 68vh; overflow: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.data-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; }
.data-table th, .data-table td { padding: 13px 15px; text-align: right; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 2; color: var(--ink-600); background: var(--ink-50); font-size: 9px; font-weight: 800; }
.data-table td { max-width: 220px; overflow: hidden; color: var(--ink-700); text-overflow: ellipsis; font-size: 10px; }
.data-table tbody tr { cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.data-table tbody tr:hover { background: #f8f9ff; }
.data-table tbody tr.selected { background: var(--brand-50); box-shadow: inset -3px 0 var(--brand-500); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .table-state { height: 170px; text-align: center; color: var(--ink-500); white-space: normal; }
.table-hint { margin: 0; padding: 11px 20px; display: flex; align-items: center; gap: 7px; color: var(--ink-500); font-size: 9px; }
.hint-icon { width: 13px; height: 13px; display: inline-grid; place-items: center; border: 1px solid var(--ink-300); border-radius: 50%; }
.editor-card { padding: 0; overflow: visible; }
.editor-sticky { position: sticky; top: 20px; padding: 20px; }
.clear-icon-button { flex: 0 0 34px; width: 34px; height: 34px; color: var(--ink-500); border: 1px solid var(--border); background: var(--ink-50); font-size: 19px; }
.editor-help { margin: -3px 0 16px; padding: 11px 12px; border: 1px solid #dfe3ff; border-radius: 11px; color: #4f46e5; background: #f8f9ff; font-size: 9px; }
.dynamic-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; }
.dynamic-form label { min-width: 0; display: grid; align-content: start; gap: 6px; color: var(--ink-700); font-size: 10px; font-weight: 750; }
.dynamic-form .field--wide { grid-column: 1 / -1; }
.dynamic-form textarea { min-height: 100px; resize: vertical; line-height: 1.8; }
.dynamic-form input, .dynamic-form select, .dynamic-form textarea { font-size: 11px; font-weight: 400; }
.field-help { color: var(--ink-500); font-size: 8px; font-weight: 400; line-height: 1.65; }
.editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.editor-actions button { padding: 11px 10px; font-size: 10px; font-weight: 750; }
.raw-json-details { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); }
.raw-json-details summary { cursor: pointer; color: var(--ink-500); font-size: 9px; }
.raw-json { direction: ltr; text-align: left; max-height: 240px; overflow: auto; margin: 12px 0 0; padding: 13px; border-radius: 11px; color: #d1e9ff; background: #101828; font: 10px/1.7 Consolas, monospace; }
.raw-json-details:not([open]) .raw-json { display: none; }

/* Account security */
.account-security-page { display: grid; gap: 22px; }
.security-hero .permission-chip strong { direction: rtl; }
.security-grid {
    display: grid;
    grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr);
    gap: 14px;
    align-items: start;
}
.security-card { padding: 20px; }
.security-form { display: grid; gap: 13px; }
.security-form label {
    display: grid;
    gap: 7px;
    color: var(--ink-700);
    font-size: 10px;
    font-weight: 750;
}
.form-help--success { color: var(--success-600); }
.form-help--error { color: var(--danger-600); }
.security-sessions { display: grid; gap: 10px; }
.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--ink-50);
}
.session-row-main { min-width: 0; }
.session-row strong {
    display: block;
    color: var(--ink-900);
    font-size: 12px;
}
.session-row strong span {
    display: inline-flex;
    margin-right: 7px;
    padding: 3px 7px;
    border-radius: 999px;
    color: var(--success-600);
    background: var(--success-50);
    font-size: 9px;
}
.session-row small {
    display: block;
    margin-top: 6px;
    color: var(--ink-500);
    font-size: 10px;
}
.session-row button { white-space: nowrap; }

/* Feedback */
.toast-region { position: fixed; z-index: 80; left: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast { min-width: 290px; max-width: 420px; padding: 13px 15px; border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--radius-md); color: #fff; background: var(--ink-800); box-shadow: var(--shadow-lg); font-size: 11px; line-height: 1.7; animation: toast-in .25s ease both; }
.toast.success { background: #067647; }
.toast.error { background: #b42318; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1250px) {
    .main-panel { padding-inline: 24px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-grid, .split-grid, .security-grid { grid-template-columns: 1fr; }
    .editor-sticky { position: static; }
    .table-wrap { max-height: 520px; }
}

@media (max-width: 960px) {
    .shell-grid { display: block; }
    .sidebar { position: fixed; right: 0; width: 286px; transform: translateX(105%); transition: transform .24s ease; box-shadow: var(--shadow-lg); }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close, .menu-button { display: grid; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; padding: 0; border-radius: 0; background: rgba(16, 24, 40, .55); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .24s ease; }
    body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .main-panel { padding: 0 20px 34px; }
    .topbar { min-height: 82px; }
    .dashboard-hero { grid-template-columns: 1fr; }
    .report-control { max-width: 420px; }
    .login-shell { grid-template-columns: 1fr; max-width: 640px; }
    .login-showcase { min-height: 470px; padding: 35px; }
    .showcase-copy { margin-top: 70px; }
    .login-panel { padding-block: 55px; }
}

@media (max-width: 680px) {
    .main-panel { padding-inline: 14px; }
    .topbar { align-items: center; }
    .topbar-actions { gap: 6px; }
    .today-chip { display: none; }
    .user-chip { min-width: 0; padding: 6px; border: 0; background: transparent; box-shadow: none; }
    .user-details { display: none; }
    .topbar h1 { font-size: 19px; }
    .breadcrumb { display: none; }
    .workspace { padding-top: 18px; }
    .dashboard-page, .management-page { gap: 18px; }
    .dashboard-hero { min-height: 0; padding: 27px 22px; border-radius: 22px; }
    .hero-copy h2 { font-size: 29px; }
    .hero-meta { display: grid; gap: 10px; }
    .report-actions { grid-template-columns: 1fr; }
    .section-title { align-items: start; flex-direction: column; gap: 5px; }
    .kpi-grid, .module-grid { grid-template-columns: 1fr; }
    .kpi-card { padding: 18px; }
    .module-card { min-height: 138px; }
    .report-grid { grid-template-columns: 1fr; }
    .chart-wrap { height: 230px; }
    .module-hero { padding: 22px; align-items: stretch; flex-direction: column; }
    .module-hero-main { align-items: flex-start; }
    .session-row { align-items: stretch; flex-direction: column; }
    .module-hero-icon { width: 48px; height: 48px; flex-basis: 48px; }
    .permission-chip { min-width: 0; }
    .toolbar-card { align-items: stretch; flex-direction: column; }
    .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .toolbar-actions .primary-btn { grid-column: 1 / -1; justify-content: center; }
    .dynamic-form { grid-template-columns: 1fr; }
    .dynamic-form .field--wide { grid-column: auto; }
    .editor-actions { grid-template-columns: 1fr; }
    .login-page { padding: 0; background: #fff; }
    .login-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
    .login-showcase { min-height: 410px; padding: 27px 23px; }
    .showcase-copy { margin: 58px 0 28px; }
    .showcase-copy h1 { font-size: 36px; }
    .showcase-features article:nth-child(3) { display: none; }
    .showcase-footer { display: none; }
    .login-panel { padding: 42px 23px; }
    .toast-region { right: 14px; left: 14px; bottom: 14px; }
    .toast { width: 100%; min-width: 0; }
}

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

/* Purpose-built management workspaces */
.modal-open { overflow: hidden; }
.management-workspace { display: grid; gap: 18px; }
.workspace-command {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.workspace-command-copy h3 { margin: 0 0 7px; font-size: 18px; }
.workspace-command-copy p:last-child { margin: 0; max-width: 780px; color: var(--ink-600); line-height: 1.85; font-size: 11px; }
.workspace-command-actions, .inline-actions, .toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.workspace-loading, .workspace-error {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 28px;
    border: 1px dashed var(--ink-300);
    border-radius: var(--radius-lg);
    color: var(--ink-600);
    background: rgba(255, 255, 255, .72);
}
.workspace-loading strong, .workspace-loading small, .workspace-error strong, .workspace-error p { display: block; }
.workspace-loading small { margin-top: 5px; color: var(--ink-500); font-size: 10px; }
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--brand-100);
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.workspace-error-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--danger-600);
    background: var(--danger-50);
    font-weight: 900;
}
.wizard-error {
    margin-bottom: 14px;
    padding: 13px 15px;
    border: 1px solid #fecdca;
    border-radius: var(--radius-md);
    color: #b42318;
    background: var(--danger-50);
    font-size: 11px;
    line-height: 1.8;
    white-space: pre-wrap;
}
.workspace-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workspace-metrics--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.workspace-metric {
    position: relative;
    overflow: hidden;
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.workspace-metric--catalog { --metric: var(--brand-600); --metric-soft: var(--brand-50); }
.workspace-metric--success { --metric: var(--success-600); --metric-soft: var(--success-50); }
.workspace-metric--warning { --metric: var(--warning-600); --metric-soft: var(--warning-50); }
.workspace-metric--danger { --metric: var(--danger-600); --metric-soft: var(--danger-50); }
.workspace-metric--info, .workspace-metric--purple { --metric: #0e7090; --metric-soft: #ecfdff; }
.workspace-metric-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; background: var(--metric-soft); }
.workspace-metric-icon::before { content: ""; display: block; width: 16px; height: 16px; margin: 11px; border: 2px solid var(--metric); border-radius: 5px; }
.workspace-metric small, .workspace-metric strong, .workspace-metric p { display: block; }
.workspace-metric small { color: var(--ink-500); font-size: 9px; font-weight: 800; }
.workspace-metric strong { margin-top: 5px; font-size: 22px; letter-spacing: -.6px; }
.workspace-metric p { margin: 3px 0 0; color: var(--ink-500); font-size: 9px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 850;
    white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge--success { color: #027a48; background: #ecfdf3; }
.status-badge--warning { color: #b54708; background: #fffaeb; }
.status-badge--danger { color: #b42318; background: #fef3f2; }
.status-badge--info, .status-badge--blue { color: #026aa2; background: #eff8ff; }
.status-badge--purple { color: #5925dc; background: #f4f3ff; }
.status-badge--neutral { color: var(--ink-600); background: var(--ink-100); }

.catalog-panel, .operations-panel, .review-desk, .stock-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.catalog-toolbar, .operations-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px 190px;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: var(--ink-50);
}
.operations-toolbar { grid-template-columns: minmax(0, 1fr) 220px; }
.product-list-head, .operations-table-head, .stock-table-head {
    display: grid;
    gap: 12px;
    padding: 11px 18px;
    color: var(--ink-500);
    background: #fff;
    border-bottom: 1px solid var(--border);
    font-size: 9px;
    font-weight: 850;
}
.product-list-head { grid-template-columns: 2.1fr 1fr 1fr 1fr 1fr 130px; }
.operations-table-head { grid-template-columns: 1.7fr 1fr .7fr 1fr 1fr 140px; }
.stock-table-head { grid-template-columns: 1.4fr 1fr .8fr .8fr 120px; }
.product-list, .operations-queue, .stock-table-body { display: grid; }
.product-list-row, .operation-row, .stock-row {
    display: grid;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.product-list-row { grid-template-columns: 2.1fr 1fr 1fr 1fr 1fr 130px; }
.operation-row { grid-template-columns: 1.7fr 1fr .7fr 1fr 1fr 140px; }
.stock-row { grid-template-columns: 1.4fr 1fr .8fr .8fr 120px; }
.product-list-row:hover, .operation-row:hover, .stock-row:hover { background: #fafbff; }
.product-list-row:last-child, .operation-row:last-child, .stock-row:last-child { border-bottom: 0; }
.product-identity, .operation-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.product-identity img, .product-image-placeholder, .order-item img, .order-item-placeholder {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    object-fit: cover;
    border-radius: 14px;
    background: var(--ink-100);
}
.product-image-placeholder {
    display: grid;
    place-items: center;
    color: var(--ink-500);
    font-size: 8px;
    text-align: center;
}
.product-identity strong, .operation-identity strong, .product-cell strong, .operation-cell strong, .stock-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.product-identity small, .operation-identity small, .product-cell small, .operation-cell small, .stock-row small { display: block; margin-top: 4px; color: var(--ink-500); font-size: 9px; }
.old-price { text-decoration: line-through; }
.product-status-stack { display: flex; flex-wrap: wrap; gap: 5px; }
.row-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 36px;
    padding: 8px 10px;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 11px;
    font-size: 9px;
    font-weight: 850;
}
.row-action--full { width: 100%; }
.row-action-stack { display: grid; gap: 6px; }
.row-action-stack .row-action, .row-action-stack .danger-btn { width: 100%; }
.empty-state {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 32px;
    color: var(--ink-500);
    text-align: center;
}
.empty-state strong { color: var(--ink-700); font-size: 13px; }
.empty-state p { max-width: 360px; margin: 0; line-height: 1.8; font-size: 10px; }
.empty-state-icon { width: 44px; height: 44px; border-radius: 16px; background: var(--ink-100); box-shadow: inset 0 0 0 1px var(--border); }

/* Modal and forms */
.management-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(16, 24, 40, .58);
    backdrop-filter: blur(8px);
}
.management-modal {
    width: min(760px, 100%);
    max-height: calc(100vh - 44px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 30px 100px rgba(16, 24, 40, .28);
}
.management-modal--wide { width: min(1120px, 100%); }
.management-modal--wizard { width: min(1160px, 100%); }
.management-modal-header, .management-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.management-modal-footer { border-top: 1px solid var(--border); border-bottom: 0; background: var(--ink-50); }
.management-modal-header h3 { margin: 0; font-size: 18px; }
.management-modal-header p:last-child { margin: 7px 0 0; color: var(--ink-500); font-size: 10px; }
.management-modal-body { min-height: 0; overflow: auto; padding: 20px; }
.modal-footer-spacer { flex: 1; }
.modal-close { color: var(--ink-500); border: 1px solid var(--border); background: var(--ink-50); font-size: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.form-field > span { color: var(--ink-700); font-size: 10px; font-weight: 850; }
.form-field small { color: var(--ink-500); font-size: 8px; line-height: 1.6; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.form-field textarea { resize: vertical; line-height: 1.9; }
.rich-text-textarea { min-height: 420px; }
.tox.tox-tinymce {
    min-height: 460px;
    border-color: var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.tox .tox-toolbar,
.tox .tox-toolbar__overflow,
.tox .tox-toolbar__primary,
.tox .tox-menubar {
    background: var(--ink-50) !important;
}
.tox .tox-edit-area__iframe { background: #fff; }
.tox .tox-statusbar { border-top-color: var(--border) !important; }
.rich-text-editor {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--ink-50);
}
.rich-text-toolbar select {
    width: auto;
    min-width: 118px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 9px;
}
.rich-text-toolbar button {
    min-width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--ink-700);
    background: #fff;
    border: 1px solid var(--border);
    font-size: 10px;
    font-weight: 900;
}
.rich-text-toolbar button:hover { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }
.rich-text-surface {
    min-height: 300px;
    max-height: 520px;
    overflow: auto;
    padding: 16px;
    color: var(--ink-800);
    line-height: 2;
    outline: none;
}
.rich-text-surface:focus { box-shadow: inset 0 0 0 2px rgba(79, 70, 229, .16); }
.rich-text-surface:empty::before {
    content: "متن را اینجا وارد کنید";
    color: var(--ink-400);
}
.rich-text-surface h2, .rich-text-surface h3, .rich-text-surface h4 { margin: 1em 0 .45em; line-height: 1.55; }
.rich-text-surface p { margin: 0 0 .8em; }
.rich-text-surface ul, .rich-text-surface ol { margin: 0 0 .9em; padding-right: 22px; }
.rich-text-surface blockquote {
    margin: 12px 0;
    padding: 10px 14px;
    border-right: 3px solid var(--brand-500);
    border-radius: 10px;
    color: var(--ink-700);
    background: var(--brand-50);
}
.rich-text-surface a { color: var(--brand-700); text-decoration: underline; }
.choice-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.choice-card--inline { align-items: center; }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { font-size: 11px; }
.choice-card small { margin-top: 4px; color: var(--ink-500); font-size: 9px; line-height: 1.6; }
.choice-row { display: grid; gap: 9px; }
.danger-link { padding: 0; color: var(--danger-600); background: transparent; font-size: 9px; font-weight: 850; }
.editor-intro {
    display: flex;
    gap: 13px;
    margin-bottom: 17px;
    padding: 15px;
    border-radius: 16px;
    color: #344054;
    background: #f8f9ff;
    border: 1px solid #e0e7ff;
}
.editor-intro strong { display: block; margin-bottom: 4px; }
.editor-intro p { margin: 0; color: var(--ink-600); line-height: 1.8; font-size: 10px; }

/* Product wizard */
.wizard-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}
.wizard-steps button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    background: #fff;
}
.wizard-steps button span {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--ink-500);
    background: var(--ink-100);
    font-size: 10px;
    font-weight: 900;
}
.wizard-steps small { color: var(--ink-600); font-size: 9px; font-weight: 850; }
.wizard-steps .active { border-color: #c7d2fe; background: var(--brand-50); }
.wizard-steps .active span, .wizard-steps .done span { color: #fff; background: var(--brand-600); }
.wizard-content { min-height: 420px; }
.wizard-section-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.section-index { color: var(--brand-600); font-size: 11px; font-weight: 900; }
.wizard-section-heading h4 { margin: 4px 0 6px; font-size: 18px; }
.wizard-section-heading p { margin: 0; color: var(--ink-500); line-height: 1.7; font-size: 10px; }
.recommendation { align-self: start; padding: 7px 10px; border-radius: 999px; color: var(--warning-600); background: var(--warning-50); font-size: 9px; font-weight: 850; }
.media-dropzone {
    min-height: 175px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    padding: 22px;
    border: 1.5px dashed #c7d2fe;
    border-radius: 22px;
    text-align: center;
    background: linear-gradient(180deg, #f8f9ff, #fff);
    cursor: pointer;
}
.media-dropzone p { margin: 0; color: var(--ink-500); }
.media-dropzone small { color: var(--ink-500); font-size: 9px; }
.upload-cloud { width: 48px; height: 38px; border: 2px solid var(--brand-500); border-radius: 18px; background: var(--brand-50); }
.media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.media-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}
.media-card.is-main { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.media-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--ink-100); }
.media-card-actions { display: flex; justify-content: space-between; gap: 8px; padding: 9px; }
.media-card-actions button { padding: 7px 8px; font-size: 8px; }
.variant-table { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.variant-table-head, .variant-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr .8fr 72px 40px;
    gap: 9px;
    align-items: center;
    padding: 10px 12px;
}
.variant-table-head--priced, .variant-row--priced { grid-template-columns: .85fr .9fr 1fr .9fr .9fr .7fr 62px 80px; }
.variant-table-head { color: var(--ink-500); background: var(--ink-50); font-size: 9px; font-weight: 850; }
.variant-row { border-top: 1px solid var(--border); }
.price-history-list { display: grid; gap: 10px; }
.price-history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--surface);
}
.price-history-card strong { display: block; color: var(--ink-900); }
.price-history-card small, .price-history-card p { color: var(--ink-500); margin: 0; }
.user-management-list { display: grid; gap: 12px; }
.user-management-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) .8fr minmax(220px, 1.2fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    padding: 14px;
}
.user-card-main { display: flex; gap: 10px; align-items: center; }
.user-card-main strong { display: block; color: var(--ink-900); }
.user-card-main small, .user-card-permissions small { color: var(--ink-500); }
.user-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.user-card-permissions { display: grid; gap: 4px; }
.user-card-permissions span { color: var(--ink-700); font-size: 11px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.switch-control { display: inline-flex; align-items: center; justify-content: center; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control span {
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: var(--ink-200);
    position: relative;
    transition: .18s ease;
}
.switch-control span::before {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: .18s ease;
}
.switch-control input:checked + span { background: var(--success-600); }
.switch-control input:checked + span::before { transform: translateX(-16px); }
.remove-row { color: var(--danger-600); background: var(--danger-50); }
.publish-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.publish-sidebar { display: grid; align-content: start; gap: 10px; }
.compact-select {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
}
.analytics-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.analytics-kpi {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.analytics-kpi span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.analytics-kpi strong { display: block; margin-top: 8px; color: var(--text); font-size: 26px; line-height: 1; }
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.analytics-panel {
    min-width: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.analytics-panel:first-child { grid-column: 1 / -1; }
.analytics-panel-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.analytics-panel-head h4 { margin: 0; font-size: 15px; }
.analytics-panel-head small { color: var(--muted); font-size: 11px; text-align: left; }
.analytics-chart { height: 230px; position: relative; }
.analytics-line svg { width: 100%; height: 190px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #f9fafb, #fff); }
.analytics-line polyline { fill: none; stroke: #2563eb; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.analytics-axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }
.analytics-bars { height: 230px; display: flex; align-items: end; gap: 8px; border-bottom: 1px solid var(--border); padding-top: 12px; }
.analytics-bar { flex: 1; min-width: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 7px; align-items: end; }
.analytics-bar span { display: block; min-height: 4px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #2563eb, #14b8a6); }
.analytics-bar small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; text-align: center; direction: ltr; }
.analytics-ranks { display: grid; gap: 10px; }
.analytics-rank div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.analytics-rank strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.analytics-rank span { color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.analytics-rank i { display: block; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #14b8a6, #2563eb); }
.analytics-empty {
    display: grid;
    place-items: center;
    min-height: 170px;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #f9fafb;
    text-align: center;
}
@media (max-width: 980px) {
    .analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analytics-grid { grid-template-columns: 1fr; }
    .analytics-panel:first-child { grid-column: auto; }
}
@media (max-width: 560px) {
    .analytics-kpis { grid-template-columns: 1fr; }
    .analytics-panel-head { display: block; }
    .analytics-panel-head small { display: block; margin-top: 6px; text-align: right; }
    .analytics-bars { gap: 4px; }
    .analytics-bar small { font-size: 9px; }
}
.subsection-heading {
    margin: 20px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.subsection-heading strong, .subsection-heading small { display: block; }
.subsection-heading small { margin-top: 4px; color: var(--ink-500); font-size: 9px; }
.faq-builder { display: grid; gap: 10px; }
.faq-builder-row { padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.faq-row-footer { margin-top: 10px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.faq-row-footer label { display: flex; align-items: center; gap: 6px; color: var(--ink-500); font-size: 9px; }
.faq-row-footer input[type="number"] { width: 76px; padding: 8px; }
.product-review-card {
    padding: 15px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(145deg, #111827, #312e81);
}
.product-review-card span, .product-review-card strong { display: block; }
.product-review-card span { color: #c7d2fe; font-size: 9px; }
.product-review-card strong { margin-top: 6px; font-size: 15px; }
.product-review-card dl { margin: 15px 0 0; display: grid; gap: 9px; }
.product-review-card div { display: flex; justify-content: space-between; gap: 12px; }
.product-review-card dt, .product-review-card dd { margin: 0; font-size: 9px; }
.product-review-card dt { color: #98a2b3; }

/* Category, campaign, payment and content cards */
.category-board, .campaign-grid, .gateway-grid, .content-board, .faq-list, .banner-grid, .payment-review-grid {
    display: grid;
    gap: 12px;
}
.campaign-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gateway-grid, .banner-grid, .payment-review-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.category-management-card, .campaign-card, .gateway-card, .content-card-item, .faq-card, .banner-card, .payment-review-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.category-management-card {
    display: grid;
    grid-template-columns: 54px 64px minmax(0, 1fr) 100px 130px;
    align-items: center;
    gap: 14px;
    padding: 16px;
}
.category-order { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--brand-700); background: var(--brand-50); font-weight: 900; }
.category-thumb { width: 64px; height: 64px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; color: var(--ink-500); font-size: 10px; }
.category-thumb img { width: 100%; height: 100%; object-fit: cover; }
.settings-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-logo-preview { width: 150px; height: 52px; border: 1px solid var(--border); border-radius: 12px; display: grid; place-items: center; background: var(--surface-soft); overflow: hidden; color: var(--ink-500); }
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.category-card-copy div { display: flex; align-items: center; gap: 8px; }
.category-card-copy strong { font-size: 13px; }
.category-card-copy p { margin: 7px 0; color: var(--ink-600); line-height: 1.7; font-size: 10px; }
.category-slug { color: var(--ink-500); font-size: 9px; }
.category-card-stat { text-align: center; }
.category-card-stat strong, .category-card-stat small { display: block; }
.category-card-stat strong { font-size: 22px; }
.category-card-stat small { color: var(--ink-500); font-size: 9px; }
.campaign-card, .gateway-card, .payment-review-card { padding: 17px; }
.campaign-card-head, .gateway-card-head, .payment-review-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.campaign-card h4 { margin: 16px 0 8px; }
.campaign-value { color: var(--brand-700); font-size: 28px; font-weight: 900; }
.campaign-meta, .payment-meta, .detail-list, .gateway-card dl {
    display: grid;
    gap: 9px;
    margin: 16px 0;
}
.campaign-meta div, .payment-meta div, .detail-list div, .gateway-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.campaign-meta dt, .campaign-meta dd, .payment-meta dt, .payment-meta dd, .detail-list dt, .detail-list dd, .gateway-card dt, .gateway-card dd { margin: 0; font-size: 9px; }
.campaign-meta dt, .payment-meta dt, .detail-list dt, .gateway-card dt { color: var(--ink-500); }
.gateway-card.is-default { border-color: #c7d2fe; box-shadow: 0 0 0 3px rgba(99, 102, 241, .1); }
.gateway-icon { width: 42px; height: 42px; display: block; border-radius: 14px; background: var(--brand-50); }
.gateway-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0; }
.payment-amount { margin: 15px 0 10px; font-size: 24px; font-weight: 900; }

/* Order and payment detail */
.order-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.order-detail-main, .order-detail-side { display: grid; gap: 14px; align-content: start; }
.detail-section { padding: 15px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.detail-section-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.detail-section h4 { margin: 0; }
.detail-section-head span { color: var(--ink-500); font-size: 9px; }
.order-items { display: grid; gap: 8px; }
.order-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) 80px 120px; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--border); border-radius: 13px; }
.order-item-copy strong, .order-item-copy small { display: block; }
.order-item-copy small { margin-top: 4px; color: var(--ink-500); font-size: 9px; }
.order-item-quantity { color: var(--ink-600); font-size: 10px; }
.order-totals { margin-top: 12px; display: grid; gap: 8px; }
.order-totals div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-600); font-size: 10px; }
.order-total-final { padding-top: 10px; border-top: 1px solid var(--border); color: var(--ink-950) !important; font-size: 13px !important; }
.status-timeline { display: grid; gap: 10px; }
.timeline-item { display: flex; gap: 10px; }
.timeline-item > span { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-50); }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item small { margin-top: 4px; color: var(--ink-500); font-size: 9px; line-height: 1.7; }
.current-order-status { margin-bottom: 12px; }
.address-box, .customer-note, .note-box p { margin: 10px 0 0; color: var(--ink-700); line-height: 1.85; font-size: 10px; }
.terminal-state { color: var(--ink-500); font-size: 10px; }
.payment-detail { display: grid; gap: 15px; }
.payment-detail-summary { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--ink-50); }
.receipt-preview { display: block; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; color: var(--brand-700); background: #fff; }
.receipt-preview img { width: 100%; max-height: 360px; object-fit: contain; display: block; background: var(--ink-100); }
.receipt-preview span { display: block; padding: 10px; text-align: center; font-size: 10px; font-weight: 850; }
.receipt-missing { padding: 16px; border-radius: 14px; color: var(--warning-600); background: var(--warning-50); font-size: 10px; }
.note-box { padding: 13px; border-radius: 14px; background: var(--brand-50); }

/* Content and banner */
.content-card-item, .faq-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px;
    gap: 14px;
    padding: 16px;
}
.content-card-item small, .faq-card small { color: var(--brand-600); font-size: 9px; font-weight: 850; }
.content-card-item strong, .faq-card strong { display: block; margin: 5px 0 8px; font-size: 13px; }
.content-card-item p, .faq-card p { margin: 0; color: var(--ink-600); line-height: 1.8; font-size: 10px; }
.content-card-item span { color: var(--ink-500); font-size: 9px; }
.banner-card { overflow: hidden; }
.banner-preview { height: 180px; display: grid; place-items: center; color: var(--ink-500); background: var(--ink-100); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-copy { padding: 14px; }
.banner-copy small { color: var(--brand-600); font-size: 9px; font-weight: 850; }
.banner-copy strong { display: block; margin: 5px 0; font-size: 13px; }
.banner-copy p { margin: 0; color: var(--ink-600); font-size: 10px; line-height: 1.7; }
.banner-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px 14px; }
.banner-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.upload-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.file-button { display: grid; place-items: center; padding: 0 14px; border-radius: 12px; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); font-size: 10px; font-weight: 850; cursor: pointer; }
.banner-live-preview {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--ink-50);
}
.banner-live-preview > span { color: var(--ink-500); font-size: 9px; font-weight: 850; }
#bannerPreviewBox { min-height: 220px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: #fff; color: var(--ink-500); }
#bannerPreviewBox img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Stock */
.stock-row input { height: 38px; }

@media (max-width: 1250px) {
    .workspace-metrics, .workspace-metrics--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .campaign-grid, .gateway-grid, .banner-grid, .payment-review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-list-head, .operations-table-head, .stock-table-head { display: none; }
    .product-list-row, .operation-row, .stock-row { grid-template-columns: 1fr 1fr; }
    .row-action { width: 100%; }
    .order-detail-layout, .publish-layout, .banner-editor-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .workspace-command { align-items: stretch; flex-direction: column; }
    .workspace-command-actions { justify-content: stretch; }
    .workspace-command-actions button { width: 100%; }
    .workspace-metrics, .workspace-metrics--compact, .campaign-grid, .gateway-grid, .banner-grid, .payment-review-grid { grid-template-columns: 1fr; }
    .catalog-toolbar, .operations-toolbar { grid-template-columns: 1fr; }
    .product-list-row, .operation-row, .stock-row, .category-management-card { grid-template-columns: 1fr; }
    .management-modal-overlay { padding: 0; align-items: stretch; }
    .management-modal { max-height: 100vh; min-height: 100vh; border-radius: 0; }
    .management-modal-header, .management-modal-footer { padding: 14px; }
    .management-modal-body { padding: 14px; }
    .form-grid, .form-grid--three, .form-grid--two { grid-template-columns: 1fr; }
    .field-span-2, .field-span-3 { grid-column: auto; }
    .wizard-steps { grid-template-columns: 1fr; }
    .variant-table-head { display: none; }
    .variant-row { grid-template-columns: 1fr; }
    .order-item { grid-template-columns: 52px minmax(0, 1fr); }
    .content-card-item, .faq-card { grid-template-columns: 1fr; }
}
