/* ─── Yekan Bakh Fanum (titles) ─── */
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Hairline.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Thin.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Heavy.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh Fanum';
    src: url('../fonts/yekan-bakh/YekanBakhFanum-Fat.ttf') format('truetype');
    font-weight: 950;
    font-style: normal;
    font-display: swap;
}

/* ─── IRANSansX FaNum (body text) ─── */
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-UltraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-DemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Heavy.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX FaNum';
    src: url('../fonts/iransansx/IRANSansXFaNum-ExtraBlack.ttf') format('truetype');
    font-weight: 950;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-body: 'IRANSansX FaNum', Tahoma, sans-serif;
    --font-heading: 'Yekan Bakh Fanum', 'IRANSansX FaNum', Tahoma, sans-serif;
    --bg: #f1f5f9;
    --bg-subtle: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-soft: #eef2ff;
    --success: #059669;
    --success-soft: #d1fae5;
    --success-text: #065f46;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --warning-text: #92400e;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --danger-text: #991b1b;
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --bottom-nav-bg: rgba(255, 255, 255, 0.92);
    --overlay: rgba(15, 23, 42, 0.45);
    --input-bg: #ffffff;
    --table-header-bg: #f8fafc;
    --table-row-hover: #f8fafc;
    --code-bg: #f1f5f9;
    --card-hover-bg: #f8fafc;
    --card-hover-border: #cbd5e1;
    --btn-hover-bg: #f1f5f9;
    --sidebar-width: 272px;
    --topbar-height: 56px;
    --bottom-nav-height: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --topbar-total-height: calc(var(--topbar-height) + var(--safe-top));
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
    --container: 1280px;
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #0b1220;
    --bg-subtle: #111827;
    --surface: #151c2c;
    --surface-2: #1a2336;
    --border: #2a3548;
    --text: #e5eefb;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: rgba(99, 102, 241, 0.22);
    --success: #34d399;
    --success-soft: rgba(16, 185, 129, 0.18);
    --success-text: #6ee7b7;
    --warning: #fbbf24;
    --warning-soft: rgba(245, 158, 11, 0.18);
    --warning-text: #fcd34d;
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.18);
    --danger-text: #fca5a5;
    --topbar-bg: rgba(15, 23, 42, 0.88);
    --bottom-nav-bg: rgba(15, 23, 42, 0.94);
    --overlay: rgba(0, 0, 0, 0.6);
    --input-bg: #111827;
    --table-header-bg: #111827;
    --table-row-hover: rgba(148, 163, 184, 0.08);
    --code-bg: #1e293b;
    --card-hover-bg: #1a2336;
    --card-hover-border: #3b4a63;
    --btn-hover-bg: #1e293b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
}

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

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.topbar-title,
.brand-name,
.page-header h1,
.page-header-main,
.card-header h2,
.dash-card .card-header h2,
.profile-card .card-header h2,
.login-brand h1,
.login-hero h1,
.login-brand-large h1,
.login-header h2,
.coming-soon-card h2,
.highlight-value {
    font-family: var(--font-heading);
}

body.sidebar-open { overflow: hidden; }

img, svg { display: block; max-width: 100%; }

/* ─── Login ─── */
.login-page {
    min-height: 100dvh;
    background: var(--bg);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.login-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
}

.login-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vw, 3rem);
    min-height: 220px;
    color: white;
    isolation: isolate;
    background: #0c1222;
}

.login-visual-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.login-visual-spin {
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg,
        #0f172a 0deg,
        #1e1b4b 50deg,
        #4338ca 110deg,
        #6366f1 170deg,
        #8b5cf6 230deg,
        #312e81 290deg,
        #0f172a 360deg
    );
    animation: login-visual-spin 9s linear infinite;
    filter: blur(32px);
    opacity: 0.9;
}

.login-visual-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(64px);
    animation: login-visual-drift 14s ease-in-out infinite;
}

.login-visual-orb--1 {
    width: 55%;
    height: 55%;
    top: -20%;
    right: -15%;
    background: radial-gradient(circle, rgba(129,140,248,0.8) 0%, transparent 70%);
}

.login-visual-orb--2 {
    width: 45%;
    height: 45%;
    bottom: -25%;
    left: -10%;
    background: radial-gradient(circle, rgba(167,139,250,0.7) 0%, transparent 70%);
    animation-delay: -6s;
    animation-duration: 18s;
}

.login-visual-orb--3 {
    width: 35%;
    height: 35%;
    top: 40%;
    left: 55%;
    background: radial-gradient(circle, rgba(56,189,248,0.35) 0%, transparent 70%);
    animation-delay: -3s;
    animation-duration: 20s;
}

.login-visual-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
    pointer-events: none;
}

@keyframes login-visual-spin {
    to { transform: rotate(360deg); }
}

@keyframes login-visual-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-8%, 6%) scale(1.08); }
}

.login-visual-shimmer {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        105deg,
        transparent 38%,
        rgba(255,255,255,0.06) 49%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.06) 51%,
        transparent 62%
    );
    background-size: 250% 100%;
    animation: login-visual-shimmer 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes login-visual-shimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

.login-visual-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(ellipse 70% 50% at 30% 10%, rgba(255,255,255,0.08) 0%, transparent 55%),
        linear-gradient(165deg, rgba(12,18,34,0.55) 0%, rgba(18,26,51,0.35) 100%);
    pointer-events: none;
}

.login-visual-content {
    position: relative;
    z-index: 3;
    max-width: 440px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-hero {
    text-align: inherit;
}

.login-hero-logo {
    position: relative;
    width: 76px;
    height: 76px;
    margin-bottom: 1.25rem;
}

.login-hero-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    pointer-events: none;
}

.login-hero-ring--outer {
    inset: -14px;
    animation: login-ring-pulse 4s ease-in-out infinite;
}

.login-hero-ring--inner {
    inset: -6px;
    border-color: rgba(129,140,248,0.25);
    animation: login-ring-pulse 4s ease-in-out infinite reverse;
}

@keyframes login-ring-pulse {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.04); }
}

.login-hero-logo .brand-logo--lg {
    position: relative;
    z-index: 1;
    width: 76px;
    height: 76px;
    border-radius: 20px;
    margin: 0;
    box-shadow:
        0 12px 32px rgba(99, 102, 241, 0.45),
        0 0 0 1px rgba(255,255,255,0.12) inset;
}

.login-hero-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(199, 210, 254, 0.95);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.85rem;
    backdrop-filter: blur(8px);
}

.login-hero h1 {
    font-size: clamp(1.65rem, 4vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin: 0 0 0.65rem;
    background: linear-gradient(135deg, #ffffff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-hero p {
    font-size: 0.925rem;
    line-height: 1.65;
    margin: 0;
    color: rgba(226, 232, 240, 0.82);
    max-width: 34ch;
}

.login-feature-cards {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.login-feature-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.login-feature-card:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(199, 210, 254, 0.28);
    transform: translateX(-3px);
}

.login-feature-card strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.2rem;
}

.login-feature-card span {
    display: block;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(203, 213, 225, 0.75);
}

.login-feature-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(139,92,246,0.25));
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    padding: 9px;
    color: #e0e7ff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
}

.login-feature-icon svg { width: 100%; height: 100%; display: block; }

.login-visual-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.login-visual-stat {
    text-align: center;
    padding: 0.65rem 0.35rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255,255,255,0.06);
}

.login-visual-stat strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.2rem;
}

.login-visual-stat span {
    display: block;
    font-size: 0.62rem;
    line-height: 1.35;
    color: rgba(148, 163, 184, 0.85);
}

/* legacy — kept for compatibility */
.login-brand-large { margin-bottom: 2rem; }

.login-brand-large h1 {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0.75rem 0 0.35rem;
}

.login-brand-large p {
    font-size: 0.9rem;
    opacity: 0.78;
    line-height: 1.5;
    margin: 0;
}
.login-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin: 0;
    padding: 0;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 3rem);
    background:
        radial-gradient(circle at 0% 0%, rgba(99,102,241,0.07) 0%, transparent 42%),
        radial-gradient(circle at 100% 100%, rgba(139,92,246,0.05) 0%, transparent 40%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.login-panel-inner {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--surface);
    border-radius: 22px;
    padding: clamp(1.75rem, 5vw, 2.5rem);
    width: 100%;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.9) inset,
        0 20px 56px rgba(15, 23, 42, 0.09);
    border: 1px solid rgba(226, 232, 240, 0.95);
}

.login-brand-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.login-brand-mark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.brand-logo--login {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.28);
}

.login-brand-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}

.login-brand-tagline {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.login-version-badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(99, 102, 241, 0.18);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.login-header {
    margin-bottom: 1.75rem;
}

.login-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
    line-height: 1.3;
    color: var(--text);
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}

.login-form .form-group { margin-bottom: 1.25rem; }

.login-form .form-group label {
    font-size: 0.8125rem;
    margin-bottom: 0.45rem;
    color: var(--text);
}

.input-field {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: var(--surface);
}

.input-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    flex-shrink: 0;
    color: var(--text-muted);
    background: rgba(241, 245, 249, 0.9);
    border-left: 1px solid var(--border);
    padding: 0 12px;
}

.input-field:focus-within .input-field-icon {
    color: var(--primary);
    background: var(--primary-soft);
    border-left-color: rgba(99, 102, 241, 0.15);
}

.input-field-icon svg { width: 18px; height: 18px; display: block; }

.input-field-control {
    flex: 1;
    min-width: 0;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0.75rem 0.875rem;
    min-height: 46px;
}

.input-field-control:focus {
    outline: none;
    box-shadow: none !important;
}

.input-field-icon svg { width: 18px; height: 18px; display: block; }

.input-field-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-right: 1px solid var(--border);
    padding: 0;
    transition: color 0.15s, background 0.15s;
}

.input-field-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.input-field-action-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.input-field-action-icon[hidden] {
    display: none !important;
}

.input-field-action:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.login-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-top: 0.25rem;
}

.login-remember { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

.login-submit {
    font-size: 0.9375rem;
    padding: 0.8rem 1.25rem;
    min-height: 50px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.28);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.login-submit svg { width: 18px; height: 18px; flex-shrink: 0; }

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.36);
    filter: brightness(1.03);
}

.login-card-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-card-footer .powered-by {
    margin: 0;
    font-size: 0.72rem;
}

.login-dev-hint {
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.login-dev-label {
    display: block;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
}

.login-dev-creds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.login-dev-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.login-dev-item > span {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

.login-dev-item code {
    display: block;
    background: #eef2ff;
    color: var(--primary-hover);
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-dev-sep { display: none; }

.login-brand { text-align: center; margin-bottom: 2rem; }

.brand-logo {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: contain;
    flex-shrink: 0;
}

.login-brand h1 { font-size: 1.5rem; font-weight: 800; }
.login-brand p { color: var(--text-muted); font-size: 0.875rem; }
.login-hint { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 1.5rem; }

@media (min-width: 900px) {
    .login-shell { grid-template-columns: 1fr 1fr; }
    .login-visual {
        min-height: 100dvh;
        justify-content: flex-end;
        padding: clamp(2.5rem, 5vw, 4rem);
    }
    .login-visual-content { max-width: 440px; }
}

@media (max-width: 899px) {
    .login-shell { display: flex; flex-direction: column; }
    .login-visual { order: -1; min-height: 280px; }
    .login-dev-creds { grid-template-columns: 1fr; }
    .login-feature-cards,
    .login-visual-stats { display: none; }
    .login-hero { text-align: center; }
    .login-hero-logo { margin-left: auto; margin-right: auto; }
    .login-hero p { max-width: none; margin: 0 auto; }
    .login-visual-content { text-align: center; align-items: center; gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .login-visual-spin,
    .login-visual-orb,
    .login-visual-shimmer,
    .login-hero-ring--outer,
    .login-hero-ring--inner { animation: none; }
    .login-feature-card:hover { transform: none; }
}

/* ─── App Shell ─── */
.app-shell { display: flex; min-height: 100dvh; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

.sidebar {
    width: var(--sidebar-width);
    background: #0c0f1a;
    color: #e2e8f0;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    height: 100dvh;
    padding-top: var(--safe-top);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-left: 1px solid rgba(255,255,255,0.06);
}

.app-shell.sidebar-hidden .sidebar {
    transform: translateX(100%);
}

.app-shell.sidebar-hidden .app-main {
    margin-right: 0;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(99,102,241,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.875rem 0.75rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
    overscroll-behavior: none;
}

.sidebar-section {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
    display: flex;
    flex-direction: column;
    position: relative;
}

.sidebar-section.sidebar-section--fade-top,
.sidebar-section.sidebar-section--fade-bottom {
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--sidebar-fade-top, 0px),
        #000 calc(100% - var(--sidebar-fade-bottom, 0px)),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--sidebar-fade-top, 0px),
        #000 calc(100% - var(--sidebar-fade-bottom, 0px)),
        transparent 100%
    );
}

.sidebar-section::-webkit-scrollbar {
    width: 4px;
}

.sidebar-section::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 0 0.35rem 0.65rem;
    margin-bottom: 0.15rem;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    position: relative;
}

.sidebar-close {
    display: none;
    margin-right: auto;
    background: rgba(255,255,255,0.06);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}


.sidebar-menu-icon {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-close .sidebar-menu-icon {
    width: 18px;
    height: 18px;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.12);
    color: #f1f5f9;
}

.sidebar-brand .brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1.1rem; font-weight: 800; color: white; line-height: 1.2; }
.brand-tagline { font-size: 0.68rem; color: #64748b; font-weight: 500; margin-top: 0.1rem; }

.sidebar-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 0 0.65rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    /* grow with items so .sidebar-section can scroll; brand + footer stay fixed */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.42rem 0.65rem;
    border-radius: 9px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
    min-height: 36px;
    min-width: 0;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-icon {
    width: 18px; height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg { width: 16px; height: 16px; }

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #f1f5f9;
    transform: translateX(-2px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.9), rgba(124,58,237,0.85));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.nav-item.active .nav-icon svg { stroke: white; }

.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-group-toggle {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: right;
}

.nav-chevron {
    margin-right: auto;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: transform 0.2s;
}

.nav-chevron svg { width: 14px; height: 14px; }

.nav-group.open .nav-chevron { transform: rotate(180deg); }

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.15rem 0.5rem 0.35rem 0;
    margin-right: 1.75rem;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.nav-group.open .nav-submenu { display: flex; }

.nav-subitem {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-subitem:hover {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
}

.nav-subitem.active {
    background: rgba(99,102,241,0.2);
    color: #c7d2fe;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: white;
    border-radius: 0 4px 4px 0;
    opacity: 0.8;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 0.35rem 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-footer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.sidebar-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
}

.sidebar-logout-form { flex-shrink: 0; }

.sidebar-logout-btn {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-logout-btn svg { width: 16px; height: 16px; }

.sidebar-logout-btn:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

.app-main {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    min-height: var(--topbar-total-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding-top: var(--safe-top);
    padding-right: calc(clamp(0.75rem, 3vw, 1.5rem) + env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    padding-left: calc(clamp(0.75rem, 3vw, 1.5rem) + env(safe-area-inset-left, 0px));
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border: none;
    border-radius: 10px;
    width: 40px; height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--primary);
    flex-shrink: 0;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.sidebar-toggle .sidebar-menu-icon {
    width: 20px;
    height: 20px;
}

.topbar-title { font-size: 0.95rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.user-name { font-size: 0.8rem; color: var(--text-muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-content {
    padding: clamp(0.75rem, 3vw, 1.5rem);
    flex: 1;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 1.5rem);
    max-width: var(--container);
    width: 100%;
    margin: 0 auto;
}

/* ─── Bottom Nav ─── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bottom-nav-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
    z-index: 100;
    align-items: flex-end;
    justify-content: space-around;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    min-width: 52px;
    border-radius: 10px;
    transition: color 0.15s;
}

.bottom-nav-item.active { color: var(--primary); }

.bottom-nav-icon {
    width: 1.35rem;
    height: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.bottom-nav-item small { font-size: 0.6rem; }

.bottom-nav-fab {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 300;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    padding: 0;
}

.fab-sheet {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.fab-sheet:not([hidden]) {
    pointer-events: auto;
}

.fab-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.fab-sheet.is-open .fab-sheet-backdrop {
    opacity: 1;
}

.fab-sheet-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface, #fff);
    border-radius: 20px 20px 0 0;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

.fab-sheet.is-open .fab-sheet-panel {
    transform: translateY(0);
}

.fab-sheet-title {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.fab-sheet-subtitle {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.fab-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.fab-sheet-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: var(--bg-subtle, #f8fafc);
    transition: border-color 0.15s, background 0.15s;
}

.fab-sheet-option:active,
.fab-sheet-option:hover {
    border-color: var(--primary);
    background: var(--card-hover-bg);
}

.fab-sheet-option-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-sheet-option-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fab-sheet-option-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: right;
}

.fab-sheet-option-text strong {
    font-size: 0.95rem;
}

.fab-sheet-option-text small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.fab-sheet-cancel {
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 10px;
}

.fab-sheet-cancel:hover {
    background: var(--bg-subtle, #f1f5f9);
}

body.fab-sheet-open {
    overflow: hidden;
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.page-header h1 { font-size: clamp(1.25rem, 4vw, 1.5rem); font-weight: 800; }

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
}

.page-header-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (min-width: 640px) {
    .page-header-actions { width: auto; }
    .page-header-end { width: auto; }
}

.form-card { max-width: 720px; }
.form-card.form-card--wide { max-width: 1100px; }
.form-card.form-card--flush { max-width: none; width: 100%; }

.backup-days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.4rem 0.75rem;
    margin-top: 0.35rem;
}

.backup-settings-form .form-section {
    margin-bottom: 0;
    padding-bottom: 0;
}

.backup-settings-form .form-actions {
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.backup-settings-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius, 0.5rem);
    padding: 1rem 1.1rem 1.15rem;
    background: var(--surface-2, var(--bg-elevated, transparent));
}

.backup-settings-panel + .backup-settings-panel {
    margin-top: 1rem;
}

.backup-settings-panel .form-section-title {
    margin-top: 0;
    margin-bottom: 0.85rem;
}

.backup-dest-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .backup-dest-picker {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.backup-dest-chip {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.backup-dest-chip:hover {
    border-color: var(--primary, #2563eb);
}

.backup-dest-chip:has(input:checked) {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 1px var(--primary, #2563eb);
    background: color-mix(in srgb, var(--primary, #2563eb) 8%, var(--surface, #fff));
}

.backup-dest-chip input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.backup-dest-chip__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.backup-dest-chip__body strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.backup-dest-chip__body small {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.backup-destinations-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 960px) {
    .backup-destinations-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }
}

.backup-destinations-grid .backup-settings-panel {
    margin-top: 0;
    height: 100%;
}

.backup-files-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
}

.backup-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.backup-upload-form .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.backup-upload-form .btn svg {
    width: 16px;
    height: 16px;
}

.backup-upload-field {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.backup-upload-field input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.backup-file-name,
.backup-archive-msg {
    max-width: 28rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 959px) {
    .backup-page .backup-destinations-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .backup-page .backup-dest-picker {
        grid-template-columns: 1fr;
    }

    .backup-page .backup-files-header {
        flex-direction: column;
        align-items: stretch;
    }

    .backup-page .backup-upload-form {
        width: 100%;
    }

    .backup-page .backup-upload-form .btn,
    .backup-page .backup-upload-field {
        flex: 1 1 auto;
        justify-content: center;
    }

    .backup-page .backup-upload-field .btn {
        width: 100%;
        justify-content: center;
    }

    .backup-page .backup-settings-form .form-actions {
        flex-direction: column;
    }

    .backup-page .backup-settings-form .form-actions .btn {
        width: 100%;
        flex: none;
    }

    .backup-page .backup-messenger-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .backup-page .backup-messenger-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .backup-page .data-list-card .data-table thead {
        display: none;
    }

    .backup-page .data-list-card .data-table,
    .backup-page .data-list-card .data-table tbody,
    .backup-page .data-list-card .data-table tr,
    .backup-page .data-list-card .data-table td {
        display: block;
        width: 100%;
    }

    .backup-page .data-list-card .data-table tr {
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border);
    }

    .backup-page .data-list-card .data-table tr:last-child {
        border-bottom: none;
    }

    .backup-page .data-list-card .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.35rem 0;
        border: none;
        text-align: end;
    }

    .backup-page .data-list-card .data-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 600;
        text-align: start;
        flex: 0 0 auto;
        max-width: 40%;
    }

    .backup-page .data-list-card .data-table td.col-actions,
    .backup-page .data-list-card .data-table td[data-label="عملیات"] {
        justify-content: flex-end;
        padding-top: 0.55rem;
    }

    .backup-page .data-list-card .data-table td.col-actions::before,
    .backup-page .data-list-card .data-table td[data-label="عملیات"]::before {
        align-self: center;
    }

    .backup-page .data-list-card .data-table td.col-actions .row-actions {
        margin-inline: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .backup-page .backup-file-name,
    .backup-page .backup-archive-msg {
        max-width: none;
    }
}

.stats-grid.dash-stats--compact .stat-value {
    font-size: 1.15rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem 1rem;
}

@media (min-width: 640px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
}

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

.form-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.form-actions .btn { flex: 1; min-width: 120px; }

@media (min-width: 480px) {
    .form-actions .btn { flex: unset; }
}

.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ─── Dashboard ─── */
.dashboard { display: flex; flex-direction: column; gap: 1.25rem; }

.dash-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-layout-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dash-layout-switcher-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.75;
}

.dash-layout-switcher-options {
    display: inline-flex;
    padding: 0.2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.dash-layout-option {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.dash-layout-option:hover { color: white; }

.dash-layout-option.is-active {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
}

.dashboard--simple .dash-layout-switcher-label { color: var(--text-muted); }

.dashboard--simple .dash-layout-switcher-options {
    background: var(--bg);
    border-color: var(--border);
}

.dashboard--simple .dash-layout-option { color: var(--text-muted); }
.dashboard--simple .dash-layout-option.is-active {
    background: var(--primary);
    color: white;
}

.dash-simple-header { padding: 1.25rem 1.35rem; }

.dash-simple-header-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-title--compact {
    font-size: clamp(1.15rem, 4vw, 1.45rem);
    margin: 0.15rem 0;
}

.dash-greeting--compact {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.dash-simple-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.dash-highlight--compact { gap: 0.75rem; }

.dash-stats--compact .stat-card {
    padding: 0.875rem 1rem;
}

.dash-stats--compact .stat-card .dash-icon-box { display: none; }

.dash-simple-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.dash-card--weekly-chart {
    width: 100%;
}

.dash-card--weekly-chart .card-body.chart-wrap {
    padding-top: 0.35rem;
}

.chart-wrap--compact { min-height: 180px; height: 180px; }

.chart-wrap--simple {
    min-height: 280px;
    height: 280px;
    width: 100%;
}

.dash-quick-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.dash-quick-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    transition: border-color 0.15s, background 0.15s;
}

.dash-quick-link:hover {
    border-color: var(--primary);
    background: var(--card-hover-bg);
    color: var(--primary-hover);
}

.dash-quick-link .dash-svg,
.dash-quick-link svg {
    width: 1.125rem;
    height: 1.125rem;
}

.dashboard-layout-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-layout-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dashboard-layout-option:hover {
    border-color: var(--card-hover-border);
    background: var(--card-hover-bg);
}

.dashboard-layout-option.is-selected {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.dashboard-layout-option input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.dashboard-layout-option-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dashboard-layout-option-body strong {
    font-size: 0.9375rem;
}

.dashboard-layout-option-body span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.profile-section-hint {
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* ─── Profile page ─── */
.profile-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 48%, #312e81 100%);
    color: white;
    isolation: isolate;
}

.profile-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.profile-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.45;
}

.profile-hero-orb--1 {
    width: 220px;
    height: 220px;
    top: -80px;
    left: -40px;
    background: #6366f1;
}

.profile-hero-orb--2 {
    width: 180px;
    height: 180px;
    bottom: -60px;
    right: -30px;
    background: #8b5cf6;
}

.profile-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.1) 0%, rgba(15, 23, 42, 0.35) 100%);
    pointer-events: none;
}

.profile-hero-content {
    position: relative;
    z-index: 1;
    padding: clamp(1rem, 3vw, 1.5rem);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-ring {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from 180deg, #818cf8, #c4b5fd, #6366f1, #818cf8);
    opacity: 0.85;
}

.profile-avatar {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4f46e5, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    border: 3px solid rgba(15, 23, 42, 0.85);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.profile-hero-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.72;
    margin: 0 0 0.35rem;
}

.profile-hero-name {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.profile-hero-email {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    opacity: 0.82;
    text-align: right;
}

.profile-hero-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.profile-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.8125rem;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

.profile-tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.8125rem;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

.profile-tenant-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.9;
}

.profile-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.profile-stat-chip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 0;
    flex: 1 1 140px;
}

.profile-stat-chip-label {
    font-size: 0.6875rem;
    font-weight: 600;
    opacity: 0.7;
}

.profile-stat-chip-value {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.35;
}

.profile-action-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.profile-action-card:hover {
    border-color: var(--card-hover-border);
    background: var(--card-hover-bg);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.profile-action-card--button {
    width: 100%;
    text-align: right;
    font: inherit;
    cursor: pointer;
    appearance: none;
}

.profile-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-action-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.profile-action-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.profile-action-body strong {
    font-size: 0.9375rem;
}

.profile-action-body span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.profile-action-chevron {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    flex-shrink: 0;
    transform: rotate(180deg);
}

.profile-card .card-header h2 {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
}

.profile-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-card-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.profile-card-icon--primary { background: var(--primary-soft); color: var(--primary); }
.profile-card-icon--violet { background: #ede9fe; color: #7c3aed; }
.profile-card-icon--amber { background: var(--warning-soft); color: var(--warning); }

.dashboard-layout-options--profile {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.dashboard-layout-option--visual {
    position: relative;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.dashboard-layout-option--visual input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.dashboard-layout-option-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-layout-option-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.dashboard-layout-option-check {
    margin-right: auto;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    border: 2px solid var(--border);
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.dashboard-layout-option-check svg {
    width: 0.8rem;
    height: 0.8rem;
}

.dashboard-layout-option--visual.is-selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.dashboard-layout-option--visual.is-selected .dashboard-layout-option-icon {
    border-color: rgba(99, 102, 241, 0.25);
    background: white;
}

.dashboard-layout-option--visual.is-selected .dashboard-layout-option-check {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.profile-settings-grid {
    align-items: stretch;
}

@media (min-width: 720px) {
    .dashboard-layout-options--profile {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .profile-hero-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }

    .profile-hero-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .profile-hero-badges {
        display: flex;
        justify-content: center;
    }

    .profile-hero-email {
        text-align: center;
    }

    .profile-hero-stats {
        justify-content: center;
        width: 100%;
    }

    .profile-stat-chip {
        flex: 1 1 calc(50% - 0.35rem);
        text-align: center;
        align-items: center;
    }
}

@media (min-width: 900px) {
    .dash-quick-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .chart-wrap--simple {
        min-height: 320px;
        height: 320px;
    }
}

@media (max-width: 640px) {
    .chart-wrap--simple {
        min-height: 240px;
        height: 240px;
    }
}

.dash-svg { width: 100%; height: 100%; display: block; }
.dash-svg svg { width: 100%; height: 100%; display: block; }

.dash-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 12px;
}

.dash-icon-box--sm { width: 38px; height: 38px; border-radius: 11px; padding: 9px; }
.dash-icon-box--primary { background: var(--primary-soft); color: var(--primary); }
.dash-icon-box--success { background: var(--success-soft); color: var(--success); }
.dash-icon-box--danger { background: var(--danger-soft); color: var(--danger); }
.dash-icon-box--warning { background: var(--warning-soft); color: var(--warning); }
.dash-icon-box--blue { background: #dbeafe; color: #2563eb; }
.dash-icon-box--violet { background: #ede9fe; color: #7c3aed; }
.dash-icon-box--teal { background: #ccfbf1; color: #0d9488; }
.dash-icon-box--amber { background: #fef3c7; color: #d97706; }

.dash-hero {
    display: flex;
    align-items: flex-start;
    border-radius: var(--radius);
    padding: clamp(1.35rem, 4vw, 2.15rem);
    color: white;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.06) inset,
        0 8px 32px rgba(15, 23, 42, 0.18);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(165deg, #0c1222 0%, #121a33 100%);
    border: 1px solid rgba(255,255,255,0.06);
}

.dash-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.dash-hero-spin {
    position: absolute;
    inset: -45%;
    background: conic-gradient(
        from 0deg,
        #0f172a 0deg,
        #1e1b4b 45deg,
        #4338ca 90deg,
        #6366f1 135deg,
        #818cf8 180deg,
        #8b5cf6 225deg,
        #4f46e5 270deg,
        #312e81 315deg,
        #0f172a 360deg
    );
    animation: dash-hero-spin 7s linear infinite;
    filter: blur(28px);
    opacity: 0.95;
}

@keyframes dash-hero-spin {
    to { transform: rotate(360deg); }
}

.dash-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(56px);
    will-change: transform;
    animation: dash-hero-drift 11s ease-in-out infinite;
    mix-blend-mode: screen;
}

.dash-hero-orb--1 {
    width: 52%;
    height: 52%;
    top: -22%;
    right: -10%;
    background: radial-gradient(circle, rgba(129,140,248,0.9) 0%, rgba(67,56,202,0.45) 50%, transparent 70%);
    animation-delay: 0s;
}

.dash-hero-orb--2 {
    width: 44%;
    height: 44%;
    bottom: -28%;
    left: -6%;
    background: radial-gradient(circle, rgba(167,139,250,0.85) 0%, rgba(79,70,229,0.4) 50%, transparent 70%);
    animation-delay: -4s;
    animation-duration: 13s;
}

.dash-hero-orb--3 {
    width: 36%;
    height: 36%;
    top: 22%;
    left: 42%;
    background: radial-gradient(circle, rgba(99,102,241,0.75) 0%, rgba(49,46,129,0.35) 55%, transparent 72%);
    animation-delay: -7s;
    animation-duration: 15s;
}

@keyframes dash-hero-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-10%, 6%) scale(1.1); }
    50% { transform: translate(8%, -8%) scale(0.92); }
    75% { transform: translate(-4%, -5%) scale(1.05); }
}

.dash-hero-shimmer {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255,255,255,0.07) 48%,
        rgba(255,255,255,0.14) 50%,
        rgba(255,255,255,0.07) 52%,
        transparent 65%
    );
    background-size: 250% 100%;
    animation: dash-hero-shimmer 3.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes dash-hero-shimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

.dash-hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(255,255,255,0.06) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 100%, rgba(99,102,241,0.1) 0%, transparent 50%),
        linear-gradient(165deg, rgba(12,18,34,0.52) 0%, rgba(18,26,51,0.28) 48%, rgba(12,18,34,0.55) 100%);
    z-index: 2;
    pointer-events: none;
}

.dash-hero-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
}

.dash-hero-text { position: relative; z-index: 3; }

.dash-greeting-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dash-greeting-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9px;
    padding: 6px;
    opacity: 0.92;
    backdrop-filter: blur(8px);
}

.dash-greeting {
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0.78;
    margin: 0;
}

.dash-title {
    font-size: clamp(1.35rem, 5vw, 1.9rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.dash-date-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.dash-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.11);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}

.dash-date-badge svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.85; }

.dash-date-badge--gregorian {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
}

.dash-date-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.65;
    padding-left: 0.15rem;
    border-left: 1px solid rgba(255,255,255,0.15);
    margin-left: 0.1rem;
    padding-right: 0.35rem;
}

@media (prefers-reduced-motion: reduce) {
    .dash-hero-spin,
    .dash-hero-orb,
    .dash-hero-shimmer { animation: none; }
}

.dash-highlight {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

.highlight-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: clamp(1rem, 3vw, 1.35rem);
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.highlight-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

a.dash-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.dash-card-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.highlight-sales { border-right: 4px solid var(--success); }
.highlight-purchases { border-right: 4px solid #8b5cf6; }
.highlight-profit.positive { border-right: 4px solid var(--primary); }
.highlight-profit.negative { border-right: 4px solid var(--danger); }
.highlight-margin.positive { border-right: 4px solid #14b8a6; }
.highlight-margin.negative { border-right: 4px solid var(--danger); }

/* ─── Reports page ─── */
.reports-precision-note {
    margin: 1rem 0 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.reports-aging-bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.reports-aging-row { display: flex; flex-direction: column; gap: 0.3rem; }

.reports-aging-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.reports-aging-meta span { color: var(--text-muted); font-size: 0.74rem; }

.reports-aging-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.reports-aging-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #818cf8);
}

.reports-expense-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.reports-expense-kpis .text-sm { font-size: 0.72rem; display: block; margin-bottom: 0.15rem; }
.reports-expense-total { font-size: 1.15rem; font-weight: 800; }
.reports-expense-kpis small { display: block; margin-top: 0.15rem; font-size: 0.7rem; }

.reports-precision-stats,
.reports-ops-stats {
    margin-top: 0.85rem;
}

.reports-aging-grid { margin-top: 1rem; }

.reports-charts-grid {
    margin-top: 1rem;
    align-items: stretch;
}

.reports-charts-grid .chart-wrap {
    min-height: 240px;
}

.reports-page .dash-hero--compact {
    min-height: auto;
    padding: clamp(1.25rem, 4vw, 2rem);
}

.reports-period-label {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

.reports-hero-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.reports-hero-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.72);
}

.reports-hero-actions {
    margin-top: 0;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.reports-hero-ai {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.reports-hero-ai svg { width: 16px; height: 16px; }

.reports-cat-nav {
    position: sticky;
    top: calc(var(--topbar-total-height, 64px) + 0.35rem);
    z-index: 20;
    margin: 0.85rem 0 0.75rem;
    padding: 0.35rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.reports-cat-nav-track {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.15rem;
    scrollbar-width: none;
}

.reports-cat-nav-track::-webkit-scrollbar { display: none; }

.reports-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.reports-cat-chip:hover,
.reports-cat-chip.is-active {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-soft);
}

.reports-cat-chip-icon {
    width: 16px;
    height: 16px;
    display: flex;
}

.reports-cat-chip-icon svg { width: 14px; height: 14px; }

.reports-hub {
    margin: 0.25rem 0 1.25rem;
    padding: 1.1rem 1.15rem 1.2rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
}

.reports-hub-header { margin-bottom: 0.9rem; }

.reports-hub-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.reports-hub-sub {
    margin: 0.3rem 0 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.reports-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.7rem;
}

.reports-hub-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}

.reports-hub-card::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    opacity: 0.85;
}

.reports-hub-card.accent-sales::before { background: #10b981; }
.reports-hub-card.accent-purchases::before { background: #8b5cf6; }
.reports-hub-card.accent-recv::before { background: #f59e0b; }
.reports-hub-card.accent-pay::before { background: #ef4444; }
.reports-hub-card.accent-stock::before { background: #3b82f6; }
.reports-hub-card.accent-users::before { background: #06b6d4; }
.reports-hub-card.accent-exp::before { background: #ec4899; }
.reports-hub-card.accent-ai::before { background: #6366f1; }
.reports-hub-card.accent-act::before { background: #64748b; }
.reports-hub-card.accent-mgmt::before { background: #0ea5e9; }

.reports-hub-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.reports-hub-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--primary);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.reports-hub-card-icon svg { width: 18px; height: 18px; }

.reports-hub-card-body { min-width: 0; flex: 1; }

.reports-hub-card-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.reports-hub-card-desc {
    margin: 0;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.reports-hub-card-metric {
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}

.reports-hub-card-metric-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.reports-hub-card-metric-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    margin-top: 0.1rem;
}

.reports-hub-card-metric small {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.reports-hub-card-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    margin-top: 0.15rem;
    opacity: 0.55;
}

.reports-section-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin: 1.5rem 0 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--primary-soft) 70%, var(--surface)), var(--surface));
    border: 1px solid var(--border);
    scroll-margin-top: calc(var(--topbar-total-height, 64px) + 4.5rem);
}

.reports-section-banner-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.reports-section-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
    flex-shrink: 0;
}

.reports-section-banner-icon svg { width: 20px; height: 20px; }

.reports-section-banner-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.reports-section-banner-sub {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.reports-section-banner-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.reports-section-banner-link:hover { text-decoration: underline; }

.reports-section-banner.is-flash {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent);
}

@media (max-width: 720px) {
    .reports-hero-top { flex-direction: column; align-items: stretch; }
    .reports-section-banner { flex-direction: column; align-items: flex-start; }
}

.reports-ai-form {
    display: inline-flex;
}

.reports-ai-collapsible {
    margin-top: 1rem;
    overflow: hidden;
}

.reports-ai-collapsible-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1.15rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.reports-ai-collapsible-summary::-webkit-details-marker {
    display: none;
}

.reports-ai-collapsible-summary::after {
    content: '';
    margin-right: auto;
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-left: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.reports-ai-collapsible[open] .reports-ai-collapsible-summary::after {
    transform: rotate(135deg);
}

.reports-ai-collapsible-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}

.reports-ai-collapsible-icon svg {
    width: 18px;
    height: 18px;
}

.reports-ai-collapsible-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.reports-ai-collapsible-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.reports-ai-collapsible-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.reports-ai-collapsible-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.reports-ai-request-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
}

.reports-ai-request-body {
    padding: 0.85rem 1rem 1rem !important;
}

.reports-ai-request-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reports-ai-prompt-picker {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.reports-ai-prompt-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}

.reports-ai-prompt-select {
    width: 100%;
    max-width: 100%;
}

.reports-ai-prompt-desc {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.reports-ai-request-actions {
    display: flex;
    justify-content: flex-start;
}

.reports-ai-prompt-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.reports-ai-archive-template {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}

.reports-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.reports-ai-btn svg {
    width: 18px;
    height: 18px;
}

.reports-ai-restricted-hint {
    margin: 0;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    background: var(--warning-soft);
    color: var(--warning-text);
    font-size: 0.8125rem;
    max-width: 36rem;
}

.reports-ai-restricted-hint--inline {
    max-width: none;
}

.reports-ai-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.reports-ai-panel-header--compact {
    padding: 0.85rem 1rem;
}

.reports-ai-panel-title {
    margin: 0;
    font-size: 1.05rem;
}

.reports-ai-panel-meta {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reports-ai-cache-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.75rem;
}

.reports-ai-content {
    display: grid;
    gap: 0.85rem;
}

.reports-ai-section {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
}

.reports-ai-section-header {
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.reports-ai-section-body {
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.reports-ai-heading {
    margin: 0;
    font-size: 0.98rem;
    color: var(--primary);
    font-weight: 800;
}

.reports-ai-subheading {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 700;
}

.reports-ai-paragraph p {
    margin: 0.35rem 0;
    line-height: 1.8;
    color: var(--text);
}

.reports-ai-list {
    margin: 0.15rem 0 0;
    padding: 0 1.15rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.reports-ai-list li {
    line-height: 1.75;
    color: var(--text);
}

.reports-ai-list li::marker {
    color: var(--primary);
}

.reports-ai-bullet {
    position: relative;
    padding-right: 1rem;
}

.reports-ai-bullet::before {
    content: "•";
    position: absolute;
    right: 0;
    color: var(--primary);
}

.reports-ai-disclaimer {
    margin: 1rem 0 0;
    padding-top: 0.875rem;
    border-top: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.reports-ai-alert {
    margin: 0;
}

.reports-ai-archive-shell {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
}

.reports-ai-archive-empty {
    padding: 0.75rem 1rem 1rem !important;
}

.reports-ai-archive-count {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.reports-ai-archive-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    min-height: 420px;
    border-top: 1px solid var(--border);
}

.reports-ai-archive-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
    border-inline-start: 1px solid var(--border);
    background: var(--surface-2);
    overflow-y: auto;
    max-height: 560px;
}

.reports-ai-archive-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.reports-ai-archive-item:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--primary-soft);
}

.reports-ai-archive-item.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}

.reports-ai-archive-item-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.reports-ai-archive-period {
    font-size: 0.88rem;
    color: var(--text);
}

.reports-ai-archive-preview {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reports-ai-archive-date {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.reports-ai-archive-user {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.reports-ai-archive-detail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
}

.reports-ai-detail-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.reports-ai-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.reports-ai-detail-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.76rem;
    color: var(--text-muted);
}

.reports-ai-detail-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.reports-ai-detail-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
    max-height: 520px;
}

.reports-ai-archive-empty-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    min-height: 320px;
}

.reports-ai-archive-empty-detail svg {
    width: 42px;
    height: 42px;
    opacity: 0.45;
}

.reports-ai-archive-empty-detail p {
    margin: 0;
    max-width: 28rem;
    line-height: 1.65;
    font-size: 0.875rem;
}

@media (max-width: 960px) {
    .reports-ai-archive-layout {
        grid-template-columns: 1fr;
    }

    .reports-ai-archive-list {
        border-inline-start: 0;
        border-bottom: 1px solid var(--border);
        max-height: 280px;
    }

    .reports-ai-detail-body {
        max-height: none;
    }
}

/* ─── AI workspace (/Ai) ─── */
.ai-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.35rem 1.4rem;
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 80% 120% at 100% 0%, rgba(99, 102, 241, 0.18), transparent 55%),
        linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    margin-top: 0.25rem;
}

.ai-hero-copy { min-width: 0; flex: 1; }

.ai-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.ai-hero-badge svg { width: 14px; height: 14px; }

.ai-hero h1 {
    margin: 0 0 0.45rem;
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 800;
    line-height: 1.35;
    color: var(--text);
}

.ai-hero p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.65;
    max-width: 40rem;
}

.ai-hero-quota {
    flex-shrink: 0;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    min-width: 7.5rem;
}

.ai-hero-quota-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.ai-hero-quota-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
}

.ai-hero-quota-max {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.ai-brief-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.ai-brief-card {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.ai-brief-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.ai-brief-card--warn { border-color: color-mix(in srgb, #f59e0b 40%, var(--border)); }
.ai-brief-card--danger { border-color: color-mix(in srgb, #ef4444 40%, var(--border)); }

.ai-brief-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}

.ai-brief-icon svg { width: 18px; height: 18px; }

.ai-brief-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.ai-brief-value {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.ai-brief-card small {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ai-context-note { padding: 0; }

.ai-context-note-inner {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem 1.15rem;
}

.ai-context-note-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-muted);
    flex-shrink: 0;
}

.ai-context-note-icon svg { width: 18px; height: 18px; }

.ai-context-note strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.ai-context-note p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.ai-analyze-card .card-body { padding-top: 1rem; }

.ai-prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.65rem;
}

.ai-prompt-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    text-align: right;
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.ai-prompt-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.ai-prompt-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}

.ai-prompt-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--primary);
}

.ai-prompt-card-icon svg { width: 16px; height: 16px; }

.ai-prompt-card strong {
    font-size: 0.86rem;
    font-weight: 700;
}

.ai-prompt-card small {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.ai-prompt-selected-desc {
    margin: 0.85rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.ai-analyze-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.ai-analyze-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.reports-ai-btn.is-loading {
    opacity: 0.75;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .ai-brief-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .ai-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-hero-quota { align-self: flex-start; }

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

@media (max-width: 480px) {
    .ai-brief-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .reports-ai-collapsible-summary {
        align-items: flex-start;
        padding: 0.85rem 0.9rem;
        gap: 0.65rem;
    }

    .reports-ai-collapsible-subtitle {
        font-size: 0.74rem;
    }

    .reports-ai-collapsible-body {
        padding: 0.65rem;
        gap: 0.65rem;
    }

    .reports-ai-panel-header,
    .reports-ai-panel-header--compact {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 0.85rem;
    }

    .reports-ai-panel-title {
        font-size: 0.95rem;
    }

    .reports-ai-panel-meta {
        font-size: 0.76rem;
    }

    .reports-ai-request-body {
        padding: 0.75rem 0.85rem 0.85rem !important;
    }

    .reports-ai-request-actions {
        width: 100%;
    }

    .reports-ai-btn {
        width: 100%;
        justify-content: center;
    }

    .reports-ai-archive-item-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .reports-ai-detail-header {
        padding: 0.85rem;
    }

    .reports-ai-detail-body {
        padding: 0.85rem;
    }

    .reports-ai-detail-meta {
        gap: 0.35rem;
    }

    .reports-ai-detail-chip {
        font-size: 0.72rem;
    }

    .reports-ai-archive-empty-detail {
        min-height: 220px;
        padding: 1.5rem 1rem;
    }
}

.reports-highlight {
    grid-template-columns: 1fr;
}

.reports-change {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.35rem;
}

.reports-change.up { color: var(--success); }
.reports-change.down { color: var(--danger); }

.reports-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.reports-meta-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.reports-meta-links a:hover {
    text-decoration: underline;
}

.reports-stats { grid-template-columns: repeat(2, 1fr); }
.reports-order-stats { grid-template-columns: repeat(2, 1fr); }

.reports-page .card-body--flush { padding: 0; }
.reports-page .card-body--flush .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.reports-page .chart-wrap--sm { min-height: 220px; }

.reports-filter-card {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
}

.reports-main-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
}

.reports-main-tab {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
}

.reports-main-tab.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.reports-preset-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reports-preset-tab {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
}

.reports-preset-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.reports-custom-form { margin-top: 0.25rem; }

.reports-custom-fields {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.reports-custom-submit-label { visibility: hidden; }

@media (max-width: 640px) {
    .reports-custom-fields { grid-template-columns: 1fr; }
    .reports-custom-submit-label { display: none; }
}

@media (min-width: 768px) {
    .reports-highlight { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1200px) {
    .reports-highlight { grid-template-columns: repeat(3, 1fr); }
    .reports-stats { grid-template-columns: repeat(3, 1fr); }
    .reports-order-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Jalali date picker ─── */
.jalali-date-field { position: relative; }

.jalali-date-display {
    cursor: pointer;
    background: var(--surface);
}

.jalali-date-popup {
    position: absolute;
    z-index: 1200;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.jalali-date-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.jalali-date-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.jalali-date-nav {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.jalali-date-nav:hover { background: var(--surface-2, #f8fafc); }

.jalali-date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
}

.jalali-date-weekday {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.25rem 0;
}

.jalali-date-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.jalali-date-day:hover { background: rgba(99, 102, 241, 0.12); }

.jalali-date-day.is-selected {
    background: var(--primary);
    color: #fff;
}

.jalali-date-day--empty { pointer-events: none; }

.jalali-date-popup-footer {
    margin-top: 0.65rem;
    display: flex;
    justify-content: center;
}


.highlight-label { display: block; font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.highlight-value { display: block; font-size: clamp(1.1rem, 4vw, 1.55rem); font-weight: 800; line-height: 1.2; margin-top: 0.2rem; letter-spacing: -0.02em; }
.highlight-unit { font-size: 0.75rem; color: var(--text-muted); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

.dash-stats .stat-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dash-stats .stat-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-lg);
}

.dash-stats .dash-icon-box { width: 42px; height: 42px; border-radius: 12px; padding: 10px; }

.stat-content { min-width: 0; flex: 1; }
.stat-label { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-bottom: 0.15rem; }
.stat-hint { display: block; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem; }
.stat-value { display: block; font-size: clamp(0.95rem, 3vw, 1.1rem); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.dash-card--span {
    grid-column: 1 / -1;
}

.dash-card .card-header h2 { font-size: 0.925rem; font-weight: 700; margin: 0; line-height: 1.3; }

.dash-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}

.dash-card-footer .text-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.dash-card-footer .text-link:hover {
    text-decoration: underline;
}

.card-header--icon {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0.15rem 0 0;
}

.card-header-badge {
    margin-right: auto;
    min-width: 26px;
    height: 26px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.dash-table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem !important;
}

.text-muted-sm { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* Product rank list */
.product-rank-list { list-style: none; display: flex; flex-direction: column; gap: 0.875rem; }

.product-rank-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.rank-num {
    width: 30px; height: 30px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.rank-num.rank-gold { background: var(--warning-soft); color: var(--warning-text); }
.rank-num.rank-silver { background: var(--bg-subtle); color: var(--text-muted); }
.rank-num.rank-bronze { background: rgba(194, 65, 12, 0.15); color: #ea580c; }

.rank-info { flex: 1; min-width: 0; }

.rank-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.rank-top strong { font-size: 0.875rem; font-weight: 600; }
.rank-top code { font-size: 0.7rem; }

.rank-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.rank-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    border-radius: 99px;
    transition: width 0.6s ease;
}

.rank-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rank-revenue { font-weight: 700; color: var(--text); }

/* Alerts */
.alert-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.alert-list--after-reminders {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.alert-chip {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.45;
}

.alert-chip.alert-warning { background: var(--warning-soft); color: #92400e; }
.alert-chip.alert-info { background: #eff6ff; color: #1e40af; }

.alert-chip-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.alert-chip-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.alert-chip-body strong { font-size: 0.875rem; }
.alert-chip-body span { font-size: 0.78rem; opacity: 0.85; }

/* Timeline */
.timeline { list-style: none; }

.timeline-item {
    display: flex;
    gap: 0.875rem;
    padding-bottom: 1rem;
    position: relative;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    right: 15px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-dot {
    width: 32px; height: 32px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    z-index: 1;
}

.timeline-content { flex: 1; min-width: 0; }

.timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.timeline-head a { text-decoration: none; color: inherit; }
.timeline-head a:hover strong { color: var(--primary); }
.timeline-head strong { font-size: 0.875rem; transition: color 0.15s; }

.timeline-detail {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.timeline-content time {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-content time svg { width: 13px; height: 13px; opacity: 0.7; }

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.card-header h2 { font-size: 0.95rem; font-weight: 700; }
.card-body { padding: clamp(0.875rem, 3vw, 1.25rem); }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

/* ─── Tables (horizontal scroll on narrow screens) ─── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.table-responsive .data-table {
    min-width: 640px;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.data-table th {
    text-align: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-size: 0.8rem;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: center;
}

.data-table tr:last-child td { border-bottom: none; }
.row-warning { background: var(--warning-soft); }

code {
    background: var(--code-bg);
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--text);
}

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-soft { background: var(--primary-soft); color: var(--primary-hover); }
.badge-muted { background: var(--bg-subtle); color: var(--text-muted); }

/* ─── Forms ─── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.375rem; }

.form-control {
    width: 100%;
    padding: 0.7rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-form, .filters-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
}

.search-form .form-control, .filters-bar .form-control { flex: 1; min-width: 140px; }
.filters-bar { margin-bottom: 1rem; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 44px;
    gap: 0.35rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--btn-hover-bg); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--btn-hover-bg); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger-text); border: 1px solid transparent; }
.btn-danger:hover { filter: brightness(0.97); }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; min-height: 36px; }
.btn-block { width: 100%; }
.inline-form { display: inline-flex; margin: 0; vertical-align: middle; }

/* ─── Order Form ─── */
.order-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.product-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.qty-input { width: 100%; }

.sticky-summary { position: static; }

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

/* ─── Alerts & Toasts ─── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.875rem; }
.alert.validation-summary-valid:empty,
.validation-summary-valid {
    display: none;
}
.alert-error { background: var(--danger-soft); color: #991b1b; }
.alert-success { background: var(--success-soft); color: #065f46; }
.alert-warning { background: var(--warning-soft); color: #92400e; padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.875rem; }

.row-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.access-denied {
    text-align: center;
    padding: 4rem 1.5rem;
    max-width: 400px;
    margin: 2rem auto;
}

.access-denied-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.access-denied-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.toast {
    margin: 0 clamp(0.75rem, 3vw, 1.5rem);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.toast-success { background: var(--success-soft); color: #065f46; }
.toast-error { background: var(--danger-soft); color: #991b1b; }

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft, #eff6ff);
    border-radius: 16px;
    padding: 14px;
    color: var(--primary, #2563eb);
}

.empty-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state--compact {
    padding: 1.25rem 0.75rem;
}

.empty-state--compact .empty-icon {
    width: 44px;
    height: 44px;
    padding: 10px;
    margin-bottom: 0.5rem;
}

.empty-state--compact .empty-icon svg {
    width: 22px;
    height: 22px;
}

.empty-state--compact p {
    margin: 0;
    font-size: 0.85rem;
}

.empty-success .empty-icon {
    width: 52px;
    height: 52px;
    background: var(--success-soft);
    color: var(--success);
    border-radius: 50%;
    padding: 12px;
    opacity: 1;
}

.pagination-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0;
}

.pagination-summary {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pagination-summary-sep {
    margin: 0 0.35rem;
    opacity: 0.5;
}

.pagination {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.page-link {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.page-link:hover:not(.active):not(.is-disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--card-hover-bg);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.page-link-nav {
    padding: 0.5rem;
}

.page-link-nav svg {
    width: 16px;
    height: 16px;
    display: block;
}

.page-link-nav--next svg {
    transform: scaleX(-1);
}

.page-link.is-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 40px;
    color: var(--text-muted);
    font-size: 0.875rem;
    user-select: none;
}

.field-error { color: var(--danger); font-size: 0.8rem; }

/* ─── Responsive: Tablet ─── */
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .product-picker { grid-template-columns: 1fr auto auto; }
    .qty-input { width: 90px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .dash-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Responsive: Desktop ─── */
@media (min-width: 1025px) {
    .page-content { padding-bottom: 1.5rem; }
    .order-layout { grid-template-columns: 1fr 300px; }
    .sticky-summary { position: sticky; top: calc(var(--topbar-total-height) + 1rem); }
}

/* ─── User menu permissions ─── */
.menu-permissions-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.menu-checkboxes {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.menu-checkboxes.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.menu-hint {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.alert-info {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 1024px) {
    :root {
        --bottom-nav-height: 52px;
    }

    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .app-main { margin-right: 0; }
    .bottom-nav { display: flex; }
    .app-shell.sidebar-hidden .sidebar { transform: translateX(100%); }

    .bottom-nav {
        padding: 0.2rem 0.4rem calc(0.15rem + env(safe-area-inset-bottom));
        align-items: center;
    }

    .bottom-nav-item {
        padding: 0.2rem 0.35rem;
        min-width: 46px;
        gap: 0.05rem;
    }

    .bottom-nav-fab {
        width: 46px;
        height: 46px;
        font-size: 1.45rem;
        margin-bottom: 0;
    }

    .page-content {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    }
}

@media (display-mode: standalone) and (max-width: 1024px) {
    .page-content {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    }
}

@media (max-width: 640px) {
    .table-responsive {
        margin-inline: -0.25rem;
        padding-bottom: 0.25rem;
    }

    .dash-highlight { grid-template-columns: 1fr; }

    .page-header {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .page-header-end {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .page-header-actions .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .page-header-actions.row-actions {
        flex-wrap: wrap;
    }

    .page-header-actions.row-actions .btn {
        flex: 1 1 auto;
    }

    .page-header > .btn,
    .page-header > .page-header-end > .btn,
    .page-header .search-form {
        width: 100%;
    }

    .search-form .btn { flex-shrink: 0; }

    .data-list-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.875rem 1rem;
        gap: 0.625rem;
    }

    .data-list-toolbar .search-form {
        width: 100%;
        min-width: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .data-list-toolbar .search-form .form-control {
        width: 100%;
        min-width: 0;
    }

    .data-list-toolbar .search-form .btn {
        width: 100%;
    }

    .data-list-toolbar .btn-export {
        width: 100%;
        justify-content: center;
    }

    .page-header-actions--multi {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .page-header-actions--multi .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        font-size: 0.78rem;
        padding: 0.45rem 0.6rem;
        justify-content: center;
    }

    .topbar-title { font-size: 0.85rem; }

    /* Reports */
    .reports-main-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-inline: -0.25rem;
        padding-inline: 0.25rem;
    }

    .reports-main-tabs::-webkit-scrollbar { display: none; }

    .reports-main-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.45rem 0.85rem;
        font-size: 0.8rem;
    }

    .reports-preset-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.15rem;
        margin-inline: -0.15rem;
        padding-inline: 0.15rem;
    }

    .reports-preset-tabs::-webkit-scrollbar { display: none; }

    .reports-preset-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .reports-filter-card {
        padding: 0.85rem 0.9rem;
    }

    .reports-page .card-header--toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .reports-page .card-header--toolbar .btn-export {
        width: 100%;
        justify-content: center;
    }

    .reports-page .chart-wrap--sm {
        min-height: 180px;
    }

    .reports-hero-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .reports-hero-actions .btn,
    .reports-ai-form,
    .reports-ai-form .btn {
        width: 100%;
    }

    /* Platform / tenant */
    .tenant-edit-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .tenant-edit-hero-main {
        width: 100%;
    }

    .tenant-edit-hero-meta {
        flex-wrap: wrap;
    }

    .tenant-logo-upload {
        flex-direction: column;
        align-items: stretch;
    }

    .platform-month-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }

    .mini-stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-card .card-body {
        padding: 1rem;
    }

    .page-content {
        padding-inline: 0.75rem;
    }
}

@media (max-width: 390px) {
    .stats-grid,
    .reports-stats,
    .reports-order-stats,
    .reports-highlight,
    .platform-month-grid,
    .mini-stats-row {
        grid-template-columns: 1fr;
    }

    .bottom-nav-item small { display: none; }

    .dash-hero,
    .reports-page .dash-hero--compact {
        padding: 1rem 0.9rem;
    }

    .highlight-value {
        font-size: 1.05rem;
    }

    .stat-value,
    .dash-stats .stat-value {
        font-size: 1rem;
    }

    .page-header h1,
    .page-header .page-title {
        font-size: 1.05rem;
    }

    .tenant-edit-hero-name {
        font-size: 1.05rem;
    }

    .monitor-hero {
        padding: 1rem;
    }

    .monitor-hero-title {
        font-size: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Mini stats & modules ─── */
.mini-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.mini-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.mini-stat:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-lg);
}

.mini-stat-label { font-size: 0.75rem; color: var(--text-muted); }
.mini-stat-value { font-size: 1.1rem; font-weight: 700; }
.mini-stat-delta { font-size: 0.75rem; }
.mini-stat-delta.positive { color: #059669; }
.mini-stat-delta.negative { color: #dc2626; }

.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.chart-wrap { position: relative; min-height: 240px; height: 240px; }

.link-list { list-style: none; padding: 0; margin: 0; }

.link-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.link-list li:last-child { border-bottom: none; }

.link-list a {
    color: inherit;
    text-decoration: none;
    min-width: 0;
    flex: 1;
    transition: color 0.15s;
}

.link-list a:hover .link-list-title { color: var(--primary); }

.link-list-title {
    display: block;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text);
}

.link-list-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.link-list-amount {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.admin-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) { .admin-cards-grid { grid-template-columns: repeat(2, 1fr); } }

.admin-card .card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.admin-stats div { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.8rem; }
.admin-customers { list-style: none; padding: 0; margin: 0; }
.admin-customers li {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.875rem;
}

.reminder-list { display: flex; flex-direction: column; gap: 0.75rem; }
.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.875rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.reminder-item.priority-high { border-right: 3px solid #dc2626; }
.reminder-item.priority-medium { border-right: 3px solid #f59e0b; }
.reminder-item.priority-low { border-right: 3px solid #3b82f6; }
.reminder-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.35rem; font-size: 0.8rem; }
.reminder-actions { display: flex; flex-direction: column; gap: 0.35rem; }

.text-danger { color: #dc2626; }
.text-success { color: #059669; }
.text-warning { color: #d97706; }
.badge-muted { background: var(--bg-subtle); color: var(--text-muted); }

.api-token-stats .mini-stat-value--mono {
    font-size: 0.8125rem;
    font-family: ui-monospace, monospace;
    letter-spacing: -0.02em;
}

.api-token-grid {
    align-items: stretch;
}

.api-token-guide .card-body {
    display: flex;
    flex-direction: column;
}

.api-token-steps {
    margin: 0 1.25rem 1rem 0;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.api-token-steps li + li {
    margin-top: 0.35rem;
}

.api-token-snippet {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-muted, #f1f5f9);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.8125rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.api-token-reveal {
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
}

.api-token-reveal-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-token-reveal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.65rem;
    background: #dcfce7;
    color: #15803d;
    flex-shrink: 0;
}

.api-token-reveal-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.api-token-reveal-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.api-token-display {
    flex: 1 1 12rem;
    min-width: 0;
    word-break: break-all;
    padding: 0.65rem 0.85rem;
    background: #fff;
    border: 1px dashed #86efac;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.api-token-prefix {
    font-size: 0.8125rem;
}

.api-token-row--inactive {
    opacity: 0.72;
}

.api-token-table .col-actions {
    white-space: nowrap;
}

.text-sm {
    font-size: 0.8125rem;
}

.d-block {
    display: block;
}

.field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.card-header--toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-header--toolbar .card-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.reports-page .card-header--toolbar .btn-export {
    flex-shrink: 0;
}

.page-header-actions .btn svg {
    width: 1rem;
    height: 1rem;
    margin-left: 0.35rem;
}

@media (max-width: 640px) {
    .api-token-reveal-box {
        flex-direction: column;
        align-items: stretch;
    }

    .api-token-reveal-box .btn {
        width: 100%;
    }

    .api-token-snippet {
        font-size: 0.75rem;
    }

    .api-token-stats .mini-stat-value--mono {
        font-size: 0.75rem;
    }
}

.user-profile-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
}
.user-profile-link:hover { color: var(--primary); }

.sidebar-user-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.sidebar-user-link:hover { background: rgba(255,255,255,0.06); }

/* ─── Form sections & autocomplete ─── */
.form-card .card-body { padding: 1.25rem 1.5rem; }

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-optional .form-section-title { color: var(--text-muted); }

.section-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
}

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

.locked-field {
    background: var(--bg) !important;
    color: var(--text-muted);
    cursor: not-allowed;
}

.field-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.supplier-autocomplete-wrap,
.customer-autocomplete-wrap { position: relative; }

.autocomplete-list {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 50;
    margin-top: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
}

.autocomplete-list.hidden { display: none; }

.autocomplete-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: none;
    background: none;
    text-align: right;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--primary-soft);
}

.autocomplete-item-title { font-size: 0.875rem; font-weight: 600; color: var(--text); }

.autocomplete-item-meta { font-size: 0.75rem; color: var(--text-muted); }

.autocomplete-empty {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
}

.autocomplete-hint {
    padding: 0.45rem 0.85rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ─── Purchase create form ─── */
.purchase-create-form .purchase-supplier-section {
    margin-bottom: 1.25rem;
}

.purchase-create-form .purchase-supplier-section > label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.purchase-lines-section {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.purchase-lines-intro {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.purchase-list-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.purchase-list-filters .form-control {
    flex: 1 1 10rem;
    min-width: 0;
}

.purchase-create-form .form-section-hint {
    margin: -0.25rem 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.purchase-line-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: end;
}

.purchase-line-picker .form-group { margin-bottom: 0; }

.purchase-line-picker label {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: block;
}

.purchase-action-label { visibility: hidden; height: 0; margin: 0; }

.purchase-create-form .order-products .empty-state {
    margin-top: 0;
    border-top: 1px solid var(--border);
}

.summary-row-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    row-gap: 0.2rem;
}

/* نوشته مبلغ به حروف دقیقاً زیر ردیف «جمع کل» */
.summary-row-total > .money-words {
    flex: 1 0 100%;
    width: 100%;
    margin-top: 0.1rem;
    text-align: start;
}

.btn-block-mobile { width: 100%; }

@media (min-width: 640px) {
    .purchase-line-picker {
        grid-template-columns: 5.5rem minmax(7rem, 1fr) auto;
        gap: 0.5rem;
    }

    .purchase-field-name { grid-column: 1 / -1; grid-row: 1; }
    .purchase-field-qty { grid-column: 1; grid-row: 2; }
    .purchase-field-price { grid-column: 2; grid-row: 2; }
    .purchase-field-action { grid-column: 3; grid-row: 2; }

    .purchase-action-label { visibility: visible; height: auto; }

    .purchase-field-action .btn { white-space: nowrap; min-width: 5.5rem; }

    .btn-block-mobile { width: auto; }
}

.payment-method-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.payment-method-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    flex: 1 1 6rem;
    min-width: 0;
    margin: 0;
    background: var(--surface);
    color: var(--text);
}

.payment-method-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft, #eff6ff);
}

/* Payables opening balance — debt vs credit */
.balance-kind-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.balance-kind-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 520px) {
    .balance-kind-picker {
        grid-template-columns: 1fr 1fr;
    }
}

.balance-kind-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.balance-kind-option:hover {
    border-color: color-mix(in srgb, var(--text-muted) 35%, var(--border));
}

.balance-kind-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.balance-kind-option__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.balance-kind-option__body strong {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.balance-kind-option__body small {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.balance-kind-option--debt:has(input:checked) {
    border-color: var(--warning, #d97706);
    box-shadow: 0 0 0 1px var(--warning, #d97706);
    background: color-mix(in srgb, var(--warning, #d97706) 10%, var(--surface, #fff));
}

.balance-kind-option--debt:has(input:checked) .balance-kind-option__body strong {
    color: var(--warning-text, #b45309);
}

.balance-kind-option--credit:has(input:checked) {
    border-color: var(--success, #16a34a);
    box-shadow: 0 0 0 1px var(--success, #16a34a);
    background: color-mix(in srgb, var(--success, #16a34a) 10%, var(--surface, #fff));
}

.balance-kind-option--credit:has(input:checked) .balance-kind-option__body strong {
    color: var(--success-text, #15803d);
}

html[data-theme="dark"] .balance-kind-option--debt:has(input:checked) {
    background: color-mix(in srgb, var(--warning, #d97706) 18%, var(--surface));
}

html[data-theme="dark"] .balance-kind-option--credit:has(input:checked) {
    background: color-mix(in srgb, var(--success, #16a34a) 18%, var(--surface));
}

.balance-type-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.balance-type-tag--debt {
    background: var(--warning-soft, #fef3c7);
    color: var(--warning-text, #b45309);
}

.balance-type-tag--credit {
    background: var(--success-soft, #dcfce7);
    color: var(--success-text, #15803d);
}

/* ─── Utility ─── */
.hidden { display: none !important; }

/* ─── Invoice create (sales / purchase) ─── */
.invoice-create-form .invoice-partner-block {
    padding: 1rem 1.125rem;
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.invoice-create-form .invoice-partner-block .form-control {
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    box-shadow: none;
}

.invoice-create-form .invoice-partner-block .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.invoice-create-form .invoice-lines-section {
    margin-top: 0.25rem;
}

.invoice-create-form .invoice-lines-intro {
    margin: 0 0 0.65rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.invoice-create-form .invoice-line-picker {
    display: grid;
    gap: 0.625rem 0.75rem;
    align-items: end;
    padding: 0.875rem 1rem 1.35rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.invoice-create-form .invoice-line-picker .form-group {
    margin-bottom: 0;
    min-width: 0;
}

/* فروش: سطر ۱ = جستجوی نام | سطر ۲ = اطلاعات | سطر ۳ = تعداد + قیمت + تخفیف + افزودن */
.invoice-line-picker--sale {
    grid-template-columns: 5rem minmax(0, 1fr) minmax(5.5rem, 0.75fr) auto;
}

.invoice-line-picker--sale .invoice-field--search { grid-column: 1 / -1; grid-row: 1; }
.invoice-line-picker--sale .product-lookup-info { grid-column: 1 / -1; grid-row: 2; }
.invoice-line-picker--sale .invoice-field--qty { grid-column: 1; grid-row: 3; }
.invoice-line-picker--sale .invoice-field--price { grid-column: 2; grid-row: 3; }
.invoice-line-picker--sale .invoice-field--discount { grid-column: 3; grid-row: 3; }
.invoice-line-picker--sale .invoice-field--action { grid-column: 4; grid-row: 3; }

.product-autocomplete-wrap {
    position: relative;
}

.product-autocomplete-wrap .form-control.is-found {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success-text);
    font-weight: 600;
}

.product-title-display {
    background: var(--surface-2);
    color: var(--text);
    cursor: default;
}

.product-title-display.is-found {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success-text);
    font-weight: 600;
}

.product-title-display.is-error {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger-text);
    font-weight: 500;
}

.product-lookup-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.55rem 0.75rem;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--primary-hover);
}

.product-lookup-info.hidden { display: none; }

.product-lookup-info.is-error {
    background: var(--danger-soft);
    border-color: var(--border);
    color: var(--danger-text);
}

.product-lookup-info strong {
    font-weight: 700;
    margin-left: 0.25rem;
}

.product-price-hint {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-muted, #94a3b8);
}

.product-price-hint.hidden { display: none; }

.product-price-hint.is-error {
    color: #b45309;
    font-weight: 500;
}

.warehouse-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.warehouse-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.warehouse-stat-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-lg);
}

.warehouse-stat-card--warn {
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, 0.35);
}

.warehouse-stat-card--warn:hover {
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, 0.5);
}

.warehouse-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.warehouse-stat-value {
    font-size: 1.35rem;
    color: var(--text);
}

.warehouse-stat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.warehouse-filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.warehouse-filter-tab {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
}

.warehouse-filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.invoice-list-filters {
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.invoice-list-filters-panel {
    border-bottom: 1px solid var(--border);
}

.invoice-list-filters-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    background: var(--surface-2);
    user-select: none;
}

.invoice-list-filters-summary::-webkit-details-marker {
    display: none;
}

.invoice-list-filters-summary::after {
    content: "‹";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    transform: rotate(-90deg);
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.invoice-list-filters-panel[open] > .invoice-list-filters-summary::after {
    transform: rotate(90deg);
    background: var(--primary-soft);
    color: var(--primary);
}

.invoice-list-filters-summary-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.invoice-list-filters-summary-icon {
    display: inline-flex;
    color: var(--text-muted);
}

.invoice-list-filters-summary-icon svg {
    width: 16px;
    height: 16px;
}

.invoice-list-filters-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    white-space: nowrap;
}

.invoice-list-filters {
    padding: 0 1rem 0.85rem;
}

.invoice-list-filters-sections {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.invoice-list-filters-section {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.invoice-list-filters-section-title {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.invoice-list-filters-grid {
    display: grid;
    gap: 0.65rem;
    align-items: end;
}

.invoice-list-filters-grid--status {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}

.invoice-list-filters-grid--payment {
    grid-template-columns: minmax(9.5rem, 1.15fr) repeat(2, minmax(8.5rem, 1fr));
}

.invoice-list-filters .form-group {
    margin-bottom: 0;
}

.invoice-list-filters label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.invoice-list-filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ─── Warehouse filters panel ─── */
.warehouse-filters {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.warehouse-filters .warehouse-filter-tabs {
    margin: 0;
    padding: 0.85rem 1rem 0.65rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.45rem;
}

.warehouse-filters .warehouse-filter-tabs::-webkit-scrollbar {
    display: none;
}

.warehouse-list-filters {
    padding: 0 1rem 0.9rem;
    border-bottom: none;
}

.warehouse-list-filters-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.warehouse-list-filters .form-group {
    margin-bottom: 0;
}

.warehouse-list-filters label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.warehouse-list-filters-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0;
    align-items: center;
}

.warehouse-list-filters-actions .btn {
    white-space: nowrap;
}

@media (min-width: 960px) {
    .invoice-list-filters-panel:not([open]) > .invoice-list-filters {
        display: block !important;
    }

    .invoice-list-filters-summary {
        cursor: default;
        background: #fff;
        border-bottom: 1px solid var(--border);
    }

    .invoice-list-filters-summary::after {
        display: none;
    }

    .invoice-list-filters {
        padding-top: 0.85rem;
    }
}

@media (max-width: 959px) {
    .invoice-list-filters-grid--payment {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-list-filters-grid--payment .form-group:first-child {
        grid-column: 1 / -1;
    }

    .invoice-list-filters-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        justify-content: center;
    }

    .warehouse-list-filters-row {
        grid-template-columns: 1fr 1fr;
    }

    .warehouse-list-filters-actions {
        grid-column: 1 / -1;
    }

    .warehouse-list-filters-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .invoice-list-filters-summary {
        padding: 0.7rem 0.85rem;
        font-size: 0.8125rem;
    }

    .invoice-list-filters {
        padding: 0 0.85rem 0.75rem;
    }

    .invoice-list-filters-section {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .invoice-list-filters-grid--status,
    .invoice-list-filters-grid--payment {
        grid-template-columns: 1fr;
    }

    .invoice-list-filters-grid--payment .form-group:first-child {
        grid-column: auto;
    }

    .invoice-list-filters-actions {
        flex-direction: column;
    }

    .invoice-list-filters-actions .btn {
        width: 100%;
        flex: none;
    }

    .invoice-list-filters-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }

    .warehouse-filters .warehouse-filter-tabs {
        padding: 0.75rem 0.85rem 0.55rem;
        margin-inline: 0;
    }

    .warehouse-filter-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
    }

    .warehouse-list-filters {
        padding: 0 0.85rem 0.85rem;
    }

    .warehouse-list-filters-row {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .warehouse-list-filters-actions {
        grid-column: auto;
        width: 100%;
        flex-direction: column;
    }

    .warehouse-list-filters-actions .btn {
        width: 100%;
        flex: none;
    }
}

.warehouse-list-card .data-list-toolbar {
    margin: 0;
}

.order-fulfillment-card .card-body {
    padding: 1.15rem 1.25rem;
}

.order-fulfillment-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.order-fulfillment-summary {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
}

.order-fulfillment-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fulfillment-workflow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.25rem;
    padding: 0.85rem 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.fulfillment-workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    min-width: 5.5rem;
    text-align: center;
}

.fulfillment-workflow-dot {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: var(--surface);
}

.fulfillment-workflow-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.fulfillment-workflow-line {
    flex: 1 1 2rem;
    max-width: 4rem;
    height: 2px;
    background: var(--border);
    margin-bottom: 1.35rem;
}

.fulfillment-workflow-step.active .fulfillment-workflow-dot {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.fulfillment-workflow-step.active .fulfillment-workflow-label {
    color: var(--primary-hover);
}

.fulfillment-workflow-step.done .fulfillment-workflow-dot {
    border-color: var(--success);
    background: var(--success);
}

.fulfillment-workflow-step.done .fulfillment-workflow-label {
    color: var(--success-text);
}

.fulfillment-workflow-step.partial .fulfillment-workflow-dot {
    border-color: var(--warning);
    background: var(--warning-soft);
}

.fulfillment-workflow-step.partial .fulfillment-workflow-label {
    color: var(--warning-text);
}

.fulfillment-workflow-line.done {
    background: var(--success);
}

.order-fulfillment-lines {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.order-fulfillment-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.order-fulfillment-line-info {
    flex: 1 1 12rem;
    min-width: 0;
}

.order-fulfillment-line-title {
    display: block;
    font-size: 0.9375rem;
}

.order-fulfillment-line-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.order-fulfillment-line-qty {
    font-weight: 600;
    color: var(--text);
}

.fulfillment-step-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem;
    background: var(--bg-subtle);
    gap: 0.15rem;
}

.fulfillment-step-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.fulfillment-step-btn:hover:not(:disabled) {
    background: var(--primary-soft);
    color: var(--primary-hover);
}

.fulfillment-step-btn.active {
    background: var(--primary);
    color: #fff;
    cursor: default;
}

.fulfillment-step-btn:disabled {
    opacity: 1;
}

.fulfillment-updated-at {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.35rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .fulfillment-workflow {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem 0;
        padding: 0.75rem 0.5rem;
    }

    .fulfillment-workflow-line {
        display: none;
    }

    .fulfillment-workflow-step {
        flex-direction: row;
        justify-content: center;
        min-width: calc(33.333% - 0.35rem);
        flex: 1 1 5rem;
        padding: 0.25rem;
    }

    .fulfillment-workflow-dot {
        width: 0.85rem;
        height: 0.85rem;
    }
}

.oversell-option .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.oversell-option input[type="checkbox"] {
    margin-top: 0.15rem;
}

@media (max-width: 768px) {
    .warehouse-stats {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .warehouse-stat-card {
        padding: 0.85rem 1rem;
    }

    .warehouse-stat-value {
        font-size: 1.2rem;
    }
}

/* خرید: سطر ۱ = نام کالا | سطر ۲ = تعداد + قیمت + افزودن */
.invoice-line-picker--purchase {
    grid-template-columns: 5rem minmax(0, 1fr) auto;
}

.invoice-line-picker--purchase .invoice-field--name { grid-column: 1 / -1; grid-row: 1; }
.invoice-line-picker--purchase .invoice-field--qty { grid-column: 1; grid-row: 2; }
.invoice-line-picker--purchase .invoice-field--price { grid-column: 2; grid-row: 2; }
.invoice-line-picker--purchase .invoice-field--action { grid-column: 3; grid-row: 2; }

.invoice-create-form .invoice-line-picker label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: block;
}

.invoice-create-form .invoice-line-picker .form-control {
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    box-shadow: none;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.invoice-create-form .invoice-line-picker .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.invoice-create-form .invoice-line-picker .form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.invoice-field--code .form-control {
    font-size: 0.8125rem;
    font-family: ui-monospace, Consolas, monospace;
    letter-spacing: 0.02em;
    padding-inline: 0.5rem;
}

.invoice-field--model .form-control,
.invoice-field--name .form-control {
    font-size: 0.9375rem;
    font-weight: 500;
}

.invoice-field--qty .form-control {
    width: 100%;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding-inline: 0.35rem;
}

.invoice-field--price .form-control {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.invoice-field--price {
    position: relative;
}

.invoice-line-picker .money-words {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    margin-top: 0.15rem;
    font-size: 0.6875rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.invoice-create-form .invoice-add-btn {
    min-height: 42px;
    border-radius: 10px;
    font-weight: 600;
    padding-inline: 1rem;
    white-space: nowrap;
}

.invoice-create-form .order-summary .form-control,
.invoice-create-form .order-summary textarea.form-control {
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text);
}

.invoice-create-form .sticky-summary {
    border-radius: 12px;
}

/* ─── خلاصه فاکتور (پنل سمت چپ) ─── */
.invoice-create-form .order-summary .card-body {
    padding: 1rem 1.1rem 1.15rem;
}

.invoice-create-form .order-summary .form-group {
    margin-bottom: 0.85rem;
}

.invoice-create-form .order-summary .form-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.invoice-create-form .order-summary .summary-row {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--border);
}

.invoice-create-form .order-summary .summary-row:last-of-type {
    border-bottom: none;
}

.invoice-create-form .order-summary .summary-row > span:last-child,
.invoice-create-form .order-summary .summary-row > strong {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.invoice-create-form .order-summary .summary-row-discount > span:last-child {
    color: var(--warning-text);
    font-weight: 700;
}

.invoice-create-form .order-summary .summary-row-total {
    margin-top: 0.35rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
    border-bottom: none;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    flex-wrap: wrap;
    row-gap: 0.2rem;
}

.invoice-create-form .order-summary .summary-row-total > strong {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.invoice-create-form .order-summary .summary-row-total > .money-words {
    flex: 1 0 100%;
    width: 100%;
    margin-top: 0.1rem;
    text-align: start;
}

.mixed-payment-panel {
    margin-top: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface-2) 100%);
    animation: invoicePanelIn 0.2s ease;
}

@keyframes invoicePanelIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-sheet-panel .form-control {
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text);
}

.payment-method-option input {
    margin: 0;
}

.money-words {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.money-words-static { margin-top: 0.15rem; }

.money-input-lg {
    font-size: 1.125rem;
    font-weight: 600;
    padding: 0.65rem 0.75rem;
}

code.code-sm { font-size: 0.75rem; }

.customer-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.customer-picker-header label { margin: 0; }

.autocomplete-create {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: none;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: right;
}

.mixed-payment-summary { margin-top: 0.5rem; }

.modal-sheet {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-sheet.hidden { display: none; }

.modal-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-sheet-panel {
    position: relative;
    width: min(100%, 28rem);
    background: var(--surface);
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
}

.modal-sheet-title {
    margin: 0 0 1rem;
    font-size: 1.125rem;
}

.modal-sheet-subsection {
    margin-top: 0.25rem;
    padding: 0.875rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.modal-sheet-subtitle {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #64748b;
}

.modal-sheet-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .sales-line-picker {
        grid-template-columns: 4.5rem minmax(10rem, 2fr) 4.5rem minmax(9rem, 1.5fr) auto;
    }

    .purchase-field-code-sm .form-control { font-size: 0.8125rem; padding: 0.45rem 0.5rem; }

    .purchase-field-model .form-control-lg { font-size: 1.05rem; padding: 0.55rem 0.65rem; }

    .purchase-field-price-lg .money-input-lg { min-width: 8rem; }

    .purchase-line-picker-name-first {
        grid-template-columns: minmax(10rem, 2fr) 4rem minmax(9rem, 1.5fr) auto;
    }

    .purchase-field-name-lg .form-control-lg {
        font-size: 1.05rem;
        padding: 0.55rem 0.65rem;
    }

    .qty-input-sm {
        max-width: 4.5rem;
        font-size: 0.875rem;
        padding: 0.45rem 0.5rem;
    }

    .modal-sheet { align-items: center; }

    .modal-sheet-panel { border-radius: var(--radius-lg, 12px); }
}

.detail-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.supplier-autocomplete-wrap.has-selection #supplierSearch,
.customer-autocomplete-wrap.has-selection #customerSearch {
    border-color: var(--success, #16a34a);
    background: var(--success-soft, #f0fdf4);
}

@media (min-width: 1025px) {
    .purchase-aside .sticky-summary,
    .purchase-create-form .order-summary.sticky-summary {
        position: sticky;
        top: calc(var(--topbar-total-height) + 1rem);
    }
}

.inline-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.page-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.page-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--primary-soft, #eff6ff);
    color: var(--primary, #2563eb);
}

.page-header-icon svg {
    width: 22px;
    height: 22px;
}

/* ─── Unified data list pages ─── */
.data-list-card { overflow: hidden; }

.data-list-card .table-responsive { border-top: none; }

.data-list-toolbar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.data-list-toolbar .search-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 200px;
}

.data-list-toolbar .form-control { flex: 1; min-width: 180px; }

.unified-search-form {
    align-items: center;
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 420px;
}

.search-field-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: var(--text-muted);
    pointer-events: none;
}

.search-field-icon svg {
    width: 18px;
    height: 18px;
}

.search-field-input {
    width: 100%;
    padding-right: 2.5rem !important;
}

.toolbar-filter-select {
    flex: 0 1 180px;
    min-width: 140px;
    max-width: 220px;
}

.btn-search {
    flex-shrink: 0;
}

.filters-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0;
}

.filters-bar .form-control { flex: 1; min-width: 140px; }

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-export svg { width: 18px; height: 18px; }

/* Icon action buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-icon svg { width: 16px; height: 16px; }

.btn-icon:hover:not(:disabled) {
    background: var(--bg);
    color: var(--text);
}

.btn-icon-edit:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-view:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-return:hover:not(:disabled) {
    border-color: #b45309;
    color: #b45309;
    background: #fffbeb;
}

.btn-icon-payment:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-report:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-sale:hover:not(:disabled) {
    border-color: #059669;
    color: #059669;
    background: #ecfdf5;
}

.btn-icon-purchase:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-complete:hover:not(:disabled) {
    border-color: #059669;
    color: #059669;
    background: #ecfdf5;
}

.btn-icon-dismiss:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

.btn-icon-delete:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.data-list-card .empty-state { padding: 2.5rem 1rem; }

.data-table .col-actions { width: 1%; white-space: nowrap; text-align: center; }

.data-table thead th.col-actions { text-align: center; }

.data-table td.col-actions,
.data-table td[data-label="عملیات"] {
    text-align: center;
    vertical-align: middle;
}

.data-table td.col-actions .row-actions,
.data-table td[data-label="عملیات"] .row-actions {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-inline: auto;
}

.data-table td.col-actions .inline-form,
.data-table td[data-label="عملیات"] .inline-form {
    display: inline-flex;
    vertical-align: middle;
}

/* ─── Collapsible optional form sections ─── */
.form-section-collapsible {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0;
    margin-bottom: 1.5rem;
    background: var(--surface-2);
}

.form-section-collapsible .form-section-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.form-section-collapsible .form-section-summary::-webkit-details-marker { display: none; }

.form-section-collapsible .form-section-summary::after {
    content: '';
    margin-right: auto;
    width: 8px;
    height: 8px;
    border-left: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s;
}

.form-section-collapsible[open] .form-section-summary::after {
    transform: rotate(135deg);
}

.form-section-collapsible .form-section-title {
    margin-bottom: 0;
    color: var(--text-muted);
}

.form-section-collapsible .form-section-body {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border);
}

.form-subsection {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border);
}

.form-subsection:first-child {
    margin-top: 0.35rem;
    padding-top: 0;
    border-top: none;
}

.form-subsection-title {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ─── Coming soon & version ─── */
.coming-soon-page {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem 3rem;
}

.coming-soon-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}

.coming-soon-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.coming-soon-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.coming-soon-card h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.coming-soon-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.coming-soon-badge {
    display: inline-block;
    padding: 0.35rem 0.875rem;
    border-radius: 999px;
    background: var(--warning-soft);
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 700;
}

.nav-soon {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
    white-space: nowrap;
}

.sidebar-footer-meta {
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 0.25rem;
}

.sidebar-version {
    text-align: center;
    font-size: 0.62rem;
    color: #475569;
    padding: 0.2rem 0.5rem 0.1rem;
    letter-spacing: 0.02em;
    width: 100%;
}

/* موبایل / ارتفاع کم: اسکرول فقط روی بخش منو (برند و فوتر ثابت) */
@media (max-width: 1024px) {
    .sidebar-section,
    .sidebar-platform-panel {
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

@media (max-height: 680px) and (min-width: 1025px) {
    .sidebar-section,
    .sidebar-platform-panel {
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

.login-footer-meta {
    margin-top: 0.75rem;
    text-align: center;
}

.login-version {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}

.powered-by {
    text-align: center;
    font-size: 0.65rem;
    color: #64748b;
    margin: 0;
    letter-spacing: 0.02em;
}

.powered-by a {
    color: #94a3b8;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.powered-by a:hover {
    color: #c7d2fe;
}

.login-footer-meta .powered-by {
    color: var(--text-muted);
}

.login-footer-meta .powered-by a {
    color: var(--primary);
}

.login-footer-meta .powered-by a:hover {
    color: var(--primary-hover);
}

/* ─── Page Loader ─── */
.velora-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.velora-loader.is-active {
    pointer-events: all;
    opacity: 1;
}

.velora-loader[hidden] {
    display: none !important;
}

.velora-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(2px) saturate(1.05);
    -webkit-backdrop-filter: blur(2px) saturate(1.05);
    transition: backdrop-filter 0.25s ease, background 0.25s ease;
}

.velora-loader-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 10001;
    background: rgba(99, 102, 241, 0.06);
    overflow: visible;
}

.velora-loader-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 0 1px 1px 0;
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.28);
}

.velora-loader-bar-glow {
    position: absolute;
    top: 0;
    height: 2px;
    width: 72px;
    background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.85), transparent);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.velora-loader.is-active .velora-loader-bar-glow {
    opacity: 1;
    animation: velora-loader-glow 1.4s ease-in-out infinite;
}

@keyframes velora-loader-glow {
    0% { transform: translateX(-100%); opacity: 0; }
    20% { opacity: 0.9; }
    80% { opacity: 0.9; }
    100% { transform: translateX(calc(100vw + 100%)); opacity: 0; }
}

body.velora-loading {
    cursor: progress;
    overflow: hidden;
}

/* ─── Invoice document (view / print) ─── */
.invoice-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
    max-width: 1240px;
    margin: 0 auto;
}

.invoice-details-page {
    max-width: 1240px;
    margin: 0 auto;
}

.invoice-details-page .page-header {
    margin-bottom: 1rem;
}

.invoice-details-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.invoice-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 4.75rem;
    box-shadow: var(--shadow);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.invoice-summary-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-lg);
}

.invoice-details-page--sale .invoice-summary-card--status:hover,
.invoice-details-page--sale .invoice-summary-card--fulfillment:hover {
    background: linear-gradient(180deg, var(--card-hover-bg), var(--primary-soft));
}

.invoice-details-page--purchase .invoice-summary-card--status:hover {
    background: linear-gradient(180deg, var(--card-hover-bg), rgba(20, 184, 166, 0.12));
}

.invoice-details-page--sale .invoice-summary-card--status,
.invoice-details-page--sale .invoice-summary-card--fulfillment {
    border-color: var(--border);
    background: linear-gradient(180deg, var(--surface), var(--primary-soft));
}

.invoice-details-page--purchase .invoice-summary-card--status {
    border-color: var(--border);
    background: linear-gradient(180deg, var(--surface), rgba(20, 184, 166, 0.12));
}

.invoice-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.invoice-summary-value {
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--text);
}

.invoice-summary-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.invoice-document-shell {
    background: transparent;
}

.invoice-side-links,
.invoice-side-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.invoice-side-back {
    margin-top: 0.75rem;
}

.invoice-returns-total {
    margin: 0.35rem 0 0.65rem;
    font-size: 0.875rem;
}

.invoice-return-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    font-size: 0.8125rem;
    background: var(--surface-2);
}

.invoice-return-link:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.print-page-body {
    margin: 0;
    min-height: 100vh;
    background: #eef1f6;
}

.invoice-print-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px -20px rgba(15, 23, 42, 0.35);
}

.invoice-print-toolbar-inner {
    max-width: 920px;
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.invoice-print-toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.5rem;
}

.invoice-print-toolbar .btn-icon {
    display: inline-flex;
    width: 1.1rem;
    height: 1.1rem;
}

.invoice-print-toolbar .btn-icon svg {
    width: 100%;
    height: 100%;
}

.invoice-print-back .btn-icon svg {
    transform: scaleX(-1);
}

.invoice-print-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
}

.invoice-print-stage .invoice-document {
    margin: 0;
}

.order-fulfillment-card {
    border-radius: 16px;
    border-color: #e7ebf2;
    box-shadow: 0 10px 28px -22px rgba(15, 23, 42, 0.28);
}

.invoice-view-main {
    min-width: 0;
}

.invoice-view-side {
    position: sticky;
    top: 1rem;
}

.invoice-side-title {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.invoice-actions-mobile {
    grid-column: 1 / -1;
    display: none;
}

.invoice-returns-block {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.invoice-document {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem 1.85rem 1.5rem;
    max-width: 920px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.invoice-document--sale .invoice-accent {
    background: linear-gradient(90deg, #4f46e5, #6366f1 55%, #818cf8);
}

.invoice-document--purchase .invoice-accent {
    background: linear-gradient(90deg, #0d9488, #14b8a6 55%, #5eead4);
}

.invoice-document--sale .invoice-brand-mark {
    color: #4338ca;
    background: linear-gradient(160deg, #eef2ff, #e0e7ff);
    border-color: #dbe1f5;
}

.invoice-document--purchase .invoice-brand-mark {
    color: #0f766e;
    background: linear-gradient(160deg, #ecfdf5, #ccfbf1);
    border-color: #99f6e4;
}

.invoice-document--sale .invoice-grand-total {
    background: linear-gradient(160deg, #eef2ff, #e0e7ff);
    border-color: #dbe1f5;
}

.invoice-document--sale .invoice-grand-total strong { color: #4338ca; }

.invoice-document--purchase .invoice-grand-total {
    background: linear-gradient(160deg, #ecfdf5, #ccfbf1);
    border-color: #99f6e4;
}

.invoice-document--purchase .invoice-grand-total strong { color: #0f766e; }

.invoice-watermark {
    position: absolute;
    inset: 35% auto auto 50%;
    transform: translateX(-50%) rotate(-18deg);
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(15, 23, 42, 0.06);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
}

.invoice-document--cancelled .invoice-watermark { color: rgba(220, 38, 38, 0.08); }
.invoice-document--draft .invoice-watermark { color: rgba(217, 119, 6, 0.08); }

.invoice-accent {
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
}

.invoice-document-header {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem 1.5rem;
    padding-bottom: 1.35rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.35rem;
}

.invoice-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.95rem;
}

.invoice-brand-mark {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid transparent;
}

.invoice-brand-mark svg {
    width: 24px;
    height: 24px;
}

.invoice-brand-mark--logo {
    padding: 0.2rem;
    overflow: hidden;
    background: #fff;
    border-color: var(--border);
}

.invoice-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.invoice-issuer {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 0.15rem;
}

.invoice-document-type {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.01em;
}

.invoice-document-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.invoice-issuer-contacts {
    list-style: none;
    margin: 0.45rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.15rem;
    max-width: 28rem;
}

.invoice-issuer-contacts li {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.invoice-issuer-contact-label {
    font-weight: 700;
    color: var(--text);
    margin-inline-end: 0.25rem;
}

.invoice-official-meta {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: 0.55rem;
    margin-bottom: 1.1rem;
    padding: 0.75rem 0.9rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.invoice-official-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.invoice-official-meta-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.invoice-document-meta {
    text-align: left;
    margin-inline-start: auto;
    min-width: min(100%, 280px);
}

.invoice-number-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    margin-bottom: 0.65rem;
}

.invoice-document-number {
    font-size: 1.55rem;
    line-height: 1.1;
    margin: 0;
    letter-spacing: 0.04em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.invoice-document-badges {
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.invoice-date-grid {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.invoice-date-item {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.65rem;
    font-size: 0.8125rem;
}

.invoice-date-item dt {
    margin: 0;
    color: var(--text-muted);
    font-weight: 500;
}

.invoice-date-item dd {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.invoice-meta-key { color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }

.invoice-document-parties {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 0.85rem;
    margin-bottom: 1.35rem;
}

.invoice-party-card {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.9rem 1rem 0.9rem 1.15rem;
}

.invoice-party-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.85rem;
    bottom: 0.85rem;
    width: 3px;
    border-radius: 3px;
    background: var(--primary);
    opacity: 0.55;
}

.invoice-document--purchase .invoice-party-card::before { background: #14b8a6; }

.invoice-party-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.invoice-party-name {
    display: block;
    font-size: 1.05rem;
    color: var(--text);
}

.invoice-party-meta {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.8125rem;
    background: var(--primary-soft);
    color: var(--primary-hover);
    padding: 0.18rem 0.5rem;
    border-radius: 7px;
}

.invoice-party-details {
    margin: 0.65rem 0 0;
    display: grid;
    gap: 0.35rem;
}

.invoice-party-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.invoice-party-detail-row dt {
    margin: 0;
    color: var(--text-muted);
    font-weight: 600;
    flex: 0 0 auto;
}

.invoice-party-detail-row dd {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    text-align: end;
    word-break: break-word;
}

.invoice-party-card--issuer {
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
}

.invoice-signature-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 1rem;
    margin-top: 0.25rem;
}

.invoice-signature-block {
    min-height: 5.5rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.invoice-signature-line {
    height: 1px;
    background: var(--border);
    margin-top: 2.5rem;
}

.invoice-lines-table tfoot .invoice-lines-summary-row td {
    background: var(--table-header-bg);
    border-top: 2px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0.7rem 0.9rem;
}

.invoice-lines-summary-label strong {
    color: var(--text);
}

.invoice-lines-table .inv-col-meta {
    white-space: nowrap;
    text-align: center;
}

.invoice-document-lines {
    position: relative;
    z-index: 1;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

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

.invoice-lines-table thead th {
    background: var(--table-header-bg);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: right;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.invoice-lines-table tbody td {
    padding: 0.78rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text);
    vertical-align: middle;
}

.invoice-lines-table tbody tr:last-child td { border-bottom: none; }
.invoice-lines-table tbody tr:nth-child(even) td { background: var(--bg-subtle); }

.invoice-lines-table .inv-col-num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-lines-table .inv-col-row { width: 2.5rem; color: var(--text-muted); text-align: center; }
.invoice-lines-table .inv-col-code { width: 1%; white-space: nowrap; }
.invoice-lines-table .inv-col-total strong { font-size: 0.95rem; }
.invoice-lines-table thead .inv-col-row,
.invoice-lines-table thead .inv-col-num { text-align: center; }
.invoice-lines-table thead .inv-col-total { text-align: left; }

.invoice-lines-table .invoice-line-title {
    display: block;
    font-weight: 600;
}

.invoice-lines-table .invoice-line-subtitle {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.invoice-lines-table code {
    font-size: 0.78rem;
    background: var(--code-bg);
    padding: 0.12rem 0.4rem;
    border-radius: 6px;
}

.inv-discount { color: var(--warning-text); font-weight: 600; }

.invoice-document-bottom {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    margin-top: 1.35rem;
}

.invoice-bottom-side {
    flex: 1 1 240px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.invoice-document-notes {
    background: var(--warning-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
}

.invoice-document-notes p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--warning-text);
}

.invoice-count-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    align-self: flex-start;
    padding: 0.4rem 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.invoice-count-divider {
    width: 1px;
    height: 0.9rem;
    background: var(--border);
}

.invoice-totals-card {
    flex: 0 0 auto;
    width: min(100%, 340px);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
}

.invoice-totals-card .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

.invoice-totals-card .summary-row > span:last-child {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.invoice-totals-card .summary-row-discount > span:last-child { color: var(--warning-text); }

.invoice-grand-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.65rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
}

.invoice-grand-total strong {
    font-size: 1.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.invoice-grand-total .invoice-currency {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.invoice-payment-block {
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border);
}

.inv-remaining-due { color: var(--danger); font-weight: 800; }
.inv-remaining-clear { color: var(--success); font-weight: 700; }

.invoice-print-footer {
    position: relative;
    z-index: 1;
    margin: 1.25rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.invoice-print-footer-brand {
    font-family: var(--font-display, inherit);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--text);
}

.invoice-print-footer-tag {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.invoice-print-footer-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    direction: ltr;
}

.no-screen {
    display: none;
}

.invoice-actions .card-body {
    max-width: none;
    margin: 0;
}

@media (max-width: 1024px) {
    .invoice-details-page {
        max-width: none;
    }

    .invoice-view-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .invoice-view-side {
        position: static;
    }

    .invoice-details-summary {
        grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    }

    .invoice-document {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .invoice-print-toolbar-inner {
        padding: 0.7rem 0.75rem;
    }

    .invoice-print-toolbar .btn {
        flex: 1 1 calc(50% - 0.35rem);
        min-width: 0;
    }

    .invoice-print-shell {
        padding: 0.85rem 0.65rem 1.5rem;
    }

    .invoice-official-meta {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-signature-row {
        grid-template-columns: 1fr;
    }

    .invoice-details-page {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .invoice-details-page .page-header {
        margin-bottom: 0.75rem;
    }

    .invoice-details-page .page-header-main h1 {
        font-size: 1.15rem;
    }

    .invoice-details-page .page-header-main .text-muted {
        font-size: 0.8rem;
        line-height: 1.45;
        word-break: break-word;
    }

    .invoice-view-layout {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* عملیات سریع بالای فاکتور در موبایل */
    .invoice-view-side {
        order: -1;
        width: 100%;
        min-width: 0;
    }

    .invoice-view-main {
        order: 0;
        width: 100%;
        min-width: 0;
    }

    .invoice-details-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
        margin-bottom: 0.9rem;
        overflow: visible;
    }

    .invoice-summary-card {
        min-width: 0;
        min-height: 0;
        padding: 0.65rem 0.7rem;
        border-radius: 12px;
        gap: 0.25rem;
    }

    .invoice-summary-label {
        font-size: 0.7rem;
    }

    .invoice-summary-value {
        font-size: 0.92rem;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }

    .invoice-summary-meta {
        font-size: 0.7rem;
    }

    .invoice-actions,
    .invoice-side-back {
        width: 100%;
        min-width: 0;
    }

    .invoice-actions .card-body {
        padding: 0.85rem 0.9rem;
    }

    .invoice-side-title {
        margin-bottom: 0.75rem;
        font-size: 0.9rem;
    }

    .invoice-side-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .invoice-side-links .btn {
        width: 100%;
        min-height: 2.5rem;
        padding-inline: 0.5rem;
        font-size: 0.8125rem;
        white-space: normal;
        line-height: 1.3;
    }

    .invoice-side-form {
        margin-top: 0.5rem;
    }

    .invoice-side-form .btn {
        min-height: 2.6rem;
        white-space: normal;
        line-height: 1.3;
    }

    .invoice-side-back {
        margin-top: 0.5rem;
    }

    .invoice-document-shell,
    .invoice-document {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .invoice-document {
        padding: 1.1rem 0.85rem 1rem;
        border-radius: 14px;
        box-shadow: 0 12px 32px -24px rgba(15, 23, 42, 0.22);
        overflow: hidden;
    }

    .invoice-document-parties {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .invoice-party-card {
        min-width: 0;
        padding: 0.8rem 0.85rem 0.8rem 1rem;
    }

    .invoice-party-name {
        font-size: 0.98rem;
        word-break: break-word;
    }

    .invoice-document-bottom {
        flex-direction: column;
        gap: 0.85rem;
        margin-top: 1rem;
    }

    .invoice-totals-card,
    .invoice-bottom-side {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .invoice-document-lines {
        overflow: visible;
        border-radius: 12px;
    }

    .invoice-document-lines .table-responsive {
        overflow: visible;
        margin-inline: 0;
        padding-bottom: 0;
    }

    /* کارت‌های اقلام به‌جای جدول افقی */
    .invoice-lines-table,
    .invoice-lines-table tbody {
        display: block;
        width: 100%;
    }

    .invoice-lines-table thead { display: none; }

    .invoice-lines-table tbody tr {
        display: block;
        width: 100%;
        padding: 0.7rem 0.75rem;
        border-bottom: 1px solid var(--border);
        box-sizing: border-box;
    }

    .invoice-lines-table tbody tr:last-child { border-bottom: none; }

    .invoice-lines-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.65rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0.3rem 0;
        border: none;
        background: transparent !important;
        text-align: end;
        white-space: normal;
    }

    .invoice-lines-table tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 600;
        flex: 0 0 auto;
        max-width: 42%;
        text-align: start;
    }

    .invoice-lines-table .inv-col-row { display: none; }

    .invoice-lines-table .inv-col-desc {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.2rem;
    }

    .invoice-lines-table .inv-col-desc::before {
        align-self: flex-start;
    }

    .invoice-lines-table .inv-col-num,
    .invoice-lines-table .inv-col-code,
    .invoice-lines-table .inv-col-total {
        white-space: normal;
    }

    .invoice-lines-table .inv-col-num > *,
    .invoice-lines-table .inv-col-total > * {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-align: end;
    }

    .invoice-lines-table .invoice-line-title,
    .invoice-lines-table .invoice-line-subtitle {
        text-align: end;
        word-break: break-word;
    }

    .invoice-totals-card .summary-row {
        gap: 0.75rem;
        align-items: flex-start;
    }

    .invoice-totals-card .summary-row > span:last-child {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-align: end;
    }

    .order-fulfillment-top {
        flex-direction: column;
        align-items: stretch;
    }

    .order-fulfillment-order-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .order-fulfillment-order-actions .inline-form,
    .order-fulfillment-order-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .invoice-details-summary {
        gap: 0.5rem;
    }

    .invoice-summary-card {
        padding: 0.6rem 0.65rem;
    }

    .invoice-summary-value {
        font-size: 0.88rem;
        line-height: 1.25;
    }

    .invoice-document {
        padding: 1rem 0.75rem 0.9rem;
        border-radius: 14px;
    }

    .invoice-brand {
        gap: 0.7rem;
    }

    .invoice-brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .invoice-brand-mark svg {
        width: 20px;
        height: 20px;
    }

    .invoice-issuer {
        font-size: 0.95rem;
    }

    .invoice-document-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .invoice-document-meta {
        width: 100%;
        min-width: 0;
        margin-inline-start: 0;
        text-align: start;
    }

    .invoice-number-block,
    .invoice-document-badges,
    .invoice-date-item {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .invoice-number-block {
        align-items: flex-start;
        margin-bottom: 0.5rem;
    }

    .invoice-document-number {
        font-size: 1.2rem;
        word-break: break-all;
    }

    .invoice-document-badges {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.35rem;
        margin-bottom: 0.55rem;
    }

    .invoice-date-grid {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .invoice-date-item {
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
    }

    .invoice-date-item dd {
        text-align: end;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .invoice-grand-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        padding: 0.7rem 0.8rem;
    }

    .invoice-grand-total strong {
        font-size: 1.1rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .order-fulfillment-card .card-body {
        padding: 0.85rem 0.75rem;
    }

    .fulfillment-workflow {
        padding: 0.6rem 0.35rem;
    }

    .fulfillment-workflow-step {
        min-width: 4.25rem;
    }

    .fulfillment-workflow-label {
        font-size: 0.7rem;
    }

    .order-fulfillment-line {
        flex-direction: column;
        align-items: stretch;
        padding: 0.7rem 0.75rem;
        gap: 0.65rem;
    }

    .fulfillment-step-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        border-radius: 12px;
        padding: 0.25rem;
        gap: 0.15rem;
    }

    .fulfillment-step-buttons .inline-form {
        display: block;
        min-width: 0;
    }

    .fulfillment-step-btn {
        width: 100%;
        padding: 0.45rem 0.25rem;
        font-size: 0.7rem;
        border-radius: 10px;
        white-space: normal;
        line-height: 1.3;
        text-align: center;
    }

    .invoice-return-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .invoice-side-links {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 400px) {
    .invoice-details-summary {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-summary-value {
        font-size: 0.84rem;
    }

    .fulfillment-step-buttons {
        grid-template-columns: 1fr;
    }

    .fulfillment-step-btn {
        white-space: normal;
        text-align: center;
        line-height: 1.35;
    }

    .order-fulfillment-order-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .invoice-line-picker--sale {
        grid-template-columns: minmax(0, 8fr) minmax(0, 2fr);
        gap: 0.55rem 0.5rem;
        padding: 0.75rem;
    }

    .invoice-line-picker--sale .invoice-field--search { grid-column: 1; grid-row: 1; }
    .invoice-line-picker--sale .invoice-field--qty { grid-column: 2; grid-row: 1; }
    .invoice-line-picker--sale .product-lookup-info { grid-column: 1 / -1; grid-row: 2; }
    .invoice-line-picker--sale .invoice-field--price { grid-column: 1 / -1; grid-row: 3; }
    .invoice-line-picker--sale .invoice-field--discount { grid-column: 1 / -1; grid-row: 4; }
    .invoice-line-picker--sale .invoice-field--action { grid-column: 1 / -1; grid-row: 5; }

    .invoice-line-picker--purchase {
        grid-template-columns: minmax(0, 8fr) minmax(0, 2fr);
        gap: 0.55rem 0.5rem;
        padding: 0.75rem;
    }

    .invoice-line-picker--purchase .invoice-field--name { grid-column: 1; grid-row: 1; }
    .invoice-line-picker--purchase .invoice-field--qty { grid-column: 2; grid-row: 1; }
    .invoice-line-picker--purchase .invoice-field--price { grid-column: 1 / -1; grid-row: 2; }
    .invoice-line-picker--purchase .invoice-field--action { grid-column: 1 / -1; grid-row: 3; }

    .invoice-line-picker--sale .invoice-field--qty .form-control,
    .invoice-line-picker--purchase .invoice-field--qty .form-control {
        padding-inline: 0.35rem;
        text-align: center;
        font-variant-numeric: tabular-nums;
    }

    .invoice-line-picker--sale .invoice-field--qty label,
    .invoice-line-picker--purchase .invoice-field--qty label {
        text-align: center;
        white-space: nowrap;
    }

    .purchase-line-picker {
        grid-template-columns: minmax(0, 8fr) minmax(0, 2fr);
        gap: 0.55rem 0.5rem;
    }

    .purchase-field-name { grid-column: 1; grid-row: 1; min-width: 0; }
    .purchase-field-qty { grid-column: 2; grid-row: 1; min-width: 0; }
    .purchase-field-price { grid-column: 1 / -1; grid-row: 2; }
    .purchase-field-action { grid-column: 1 / -1; grid-row: 3; }

    .purchase-field-qty .form-control {
        padding-inline: 0.35rem;
        text-align: center;
        font-variant-numeric: tabular-nums;
    }

    .purchase-field-qty label {
        text-align: center;
        white-space: nowrap;
    }

    .invoice-create-form .invoice-add-btn,
    .invoice-line-picker--sale .invoice-add-btn,
    .invoice-line-picker--purchase .invoice-add-btn {
        width: 100%;
    }

    .invoice-create-form .customer-picker-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .invoice-create-form .customer-picker-header .btn {
        width: 100%;
        justify-content: center;
    }

    .invoice-create-form .invoice-partner-block {
        padding: 0.875rem;
    }

    .payment-method-options {
        flex-direction: column;
    }

    .payment-method-option {
        flex: 1 1 auto;
        width: 100%;
    }

    .product-lookup-info {
        flex-direction: column;
        gap: 0.35rem;
    }

    .invoice-line-picker .money-words {
        position: static;
        margin-top: 0.25rem;
        white-space: normal;
    }

    .data-list-toolbar .search-form.unified-search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-field {
        max-width: none;
        min-width: 0;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .order-layout,
    .invoice-create-form.order-layout {
        grid-template-columns: 1fr;
    }

    .invoice-create-form .order-summary.sticky-summary,
    .order-layout .sticky-summary {
        position: static;
    }
}

@media print {
    .no-print,
    .no-screen,
    .sidebar,
    .topbar,
    .sidebar-overlay,
    .velora-loader,
    .toast,
    .page-header,
    .invoice-view-side,
    .invoice-actions-mobile,
    .invoice-print-toolbar,
    .invoice-details-summary,
    .order-fulfillment-card {
        display: none !important;
    }

    .print-page-body {
        background: #fff !important;
    }

    .invoice-print-shell {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    body,
    .app-shell,
    .app-main,
    .page-content {
        background: #fff !important;
    }

    .main-content,
    .page-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-view-layout {
        display: block;
        max-width: none;
    }

    .invoice-view-main {
        max-width: none;
    }

    .invoice-document {
        border: none;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .invoice-watermark {
        color: rgba(15, 23, 42, 0.05) !important;
    }

    .invoice-document,
    .invoice-party-card,
    .invoice-totals-card,
    .invoice-grand-total,
    .invoice-brand-mark,
    .invoice-accent,
    .invoice-lines-table thead th,
    .invoice-lines-table tbody tr:nth-child(even) td,
    .invoice-document-notes {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .invoice-document-lines,
    .invoice-document-bottom {
        break-inside: avoid;
    }

    .invoice-lines-table tbody tr {
        break-inside: avoid;
    }

    .invoice-actions {
        display: none !important;
    }

    .invoice-print-footer.no-screen {
        display: flex !important;
    }

    .invoice-signature-row,
    .invoice-signature-block {
        break-inside: avoid;
    }
}

/* --- Reminders settings --- */
.reminder-settings-form .reminder-rule-row {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.reminder-settings-form .reminder-rule-row:last-of-type {
    border-bottom: none;
}

.reminder-rule-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-weight: 600;
}

.reminder-rule-desc {
    margin: .35rem 0 .75rem 1.5rem;
    font-size: .9rem;
}

.reminder-rule-interval {
    margin-right: 1.5rem;
    max-width: 320px;
}

.reminder-rule-interval label {
    display: block;
    margin-bottom: .35rem;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
}

.reminder-interval-select {
    width: 100%;
    min-width: 200px;
    padding: .5rem .75rem;
    font-size: .9rem;
    direction: rtl;
    text-align: right;
    appearance: auto;
    cursor: pointer;
}

.reminder-rule-meta {
    margin: .5rem 1.5rem 0;
    font-size: .8rem;
}

/* --- Reminder Center --- */
.reminder-stats .warehouse-stat-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.reminder-stats .warehouse-stat-card.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.reminder-title-link {
    text-decoration: none;
    color: inherit;
}

.reminder-title-link:hover strong {
    color: var(--primary);
}

.reminder-desc {
    margin-top: 0.2rem;
    max-width: 28rem;
    line-height: 1.45;
}

.reminder-source {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
}

.reminder-table tbody tr.reminder-row--high td:first-child,
.reminder-table tbody tr.reminder-row--critical td:first-child {
    box-shadow: inset -3px 0 0 #dc2626;
}

.reminder-table tbody tr.reminder-row--overdue {
    background: color-mix(in srgb, var(--danger-soft, #fef2f2) 55%, transparent);
}

.reminder-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.reminder-detail-desc {
    margin: 0 0 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.reminder-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    margin: 0;
}

.reminder-meta-grid dt {
    margin: 0 0 0.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.reminder-meta-grid dd {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

.reminder-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.reminder-snooze-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.reminder-snooze-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-inline-end: 0.25rem;
}

.reminder-timeline .timeline-dot {
    width: 28px;
    height: 28px;
    padding: 6px;
    border-radius: 8px;
}

.reminder-timeline .timeline-detail {
    margin: 0.15rem 0 0;
}

@media (max-width: 900px) {
    .reminder-detail-layout {
        grid-template-columns: 1fr;
    }

    .reminder-meta-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .reminder-meta-grid {
        grid-template-columns: 1fr;
    }
}

.data-table td.col-actions .inline-form .btn-icon,
.data-table td[data-label="عملیات"] .inline-form .btn-icon {
    vertical-align: middle;
}

.return-qty-input { max-width: 6rem; }

/* --- Theme toggle --- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .theme-icon-moon,
.theme-toggle .theme-icon-sun {
    display: none;
    line-height: 0;
}

.theme-toggle .theme-icon-sun { display: block; }

html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }

.login-theme-toggle {
    position: fixed;
    top: calc(0.75rem + var(--safe-top));
    left: calc(0.75rem + env(safe-area-inset-left, 0px));
    z-index: 20;
}

/* --- Dark mode surface overrides --- */
html[data-theme="dark"] .app-main,
html[data-theme="dark"] .page-content {
    background: var(--bg);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .highlight-card,
html[data-theme="dark"] .mini-stat,
html[data-theme="dark"] .card,
html[data-theme="dark"] .data-list-card,
html[data-theme="dark"] .invoice-summary-card,
html[data-theme="dark"] .profile-action-card,
html[data-theme="dark"] .dash-quick-link,
html[data-theme="dark"] .autocomplete-list,
html[data-theme="dark"] .modal-sheet,
html[data-theme="dark"] .modal-sheet-panel,
html[data-theme="dark"] .jalali-date-popup,
html[data-theme="dark"] .invoice-actions.card,
html[data-theme="dark"] .invoice-side-back.card {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .card-header {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .card-header h2 {
    color: var(--text);
}

html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .highlight-value,
html[data-theme="dark"] .mini-stat-value,
html[data-theme="dark"] .invoice-summary-value,
html[data-theme="dark"] .page-header-main h1,
html[data-theme="dark"] .topbar-title {
    color: var(--text);
}

html[data-theme="dark"] .data-table th {
    background: var(--table-header-bg);
    color: var(--text-muted);
}

html[data-theme="dark"] .data-table td {
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .data-table tbody tr:hover {
    background: var(--table-row-hover);
}

html[data-theme="dark"] .invoice-list-filters-summary,
html[data-theme="dark"] .invoice-list-filters-section,
html[data-theme="dark"] .warehouse-filter-tab {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
}

html[data-theme="dark"] .warehouse-filters {
    background: var(--surface);
}

html[data-theme="dark"] .invoice-list-filters-panel[open] > .invoice-list-filters-summary::after,
html[data-theme="dark"] .invoice-list-filters-summary::after {
    background: var(--primary-soft);
    color: var(--primary);
}

html[data-theme="dark"] .invoice-list-filters-badge {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary-hover);
}

html[data-theme="dark"] .warehouse-filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .login-panel {
    background: var(--surface);
    color: var(--text);
}

html[data-theme="dark"] .login-brand-name,
html[data-theme="dark"] .login-header h2 {
    color: var(--text);
}

html[data-theme="dark"] .autocomplete-item:hover,
html[data-theme="dark"] .autocomplete-item.active {
    background: var(--primary-soft);
}

html[data-theme="dark"] .autocomplete-item-title { color: var(--text); }
html[data-theme="dark"] .autocomplete-item-meta,
html[data-theme="dark"] .autocomplete-empty,
html[data-theme="dark"] .autocomplete-hint { color: var(--text-muted); }

html[data-theme="dark"] .btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .btn-ghost {
    color: var(--text-muted);
}

html[data-theme="dark"] .btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

html[data-theme="dark"] .empty-state {
    color: var(--text-muted);
}

html[data-theme="dark"] .toast-success {
    background: var(--success-soft);
    color: var(--success-text);
}

html[data-theme="dark"] .toast-error,
html[data-theme="dark"] .alert-error {
    background: var(--danger-soft);
    color: var(--danger-text);
}

html[data-theme="dark"] .alert-success {
    background: var(--success-soft);
    color: var(--success-text);
}

html[data-theme="dark"] .alert-warning {
    background: var(--warning-soft);
    color: var(--warning-text);
}

html[data-theme="dark"] .invoice-document {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

html[data-theme="dark"] .invoice-party-card,
html[data-theme="dark"] .invoice-totals-card,
html[data-theme="dark"] .fulfillment-workflow,
html[data-theme="dark"] .order-fulfillment-card {
    background: var(--surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] .invoice-lines-table tbody tr {
    border-color: var(--border);
}

html[data-theme="dark"] .invoice-lines-table thead th {
    background: var(--table-header-bg);
    border-color: var(--border);
    color: var(--text-muted);
}

html[data-theme="dark"] .invoice-lines-table tbody tr:nth-child(even) td {
    background: var(--bg-subtle);
}

html[data-theme="dark"] .invoice-document-lines {
    border-color: var(--border);
}

html[data-theme="dark"] .payment-method-option {
    background: var(--surface);
    color: var(--text);
}

html[data-theme="dark"] .payment-method-option:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--text);
}

html[data-theme="dark"] .field-hint,
html[data-theme="dark"] .invoice-lines-intro,
html[data-theme="dark"] .purchase-lines-intro {
    color: var(--text-muted);
}

html[data-theme="dark"] .product-price-hint.is-error {
    color: var(--warning-text);
}

html[data-theme="dark"] .fulfillment-step-buttons {
    background: var(--bg-subtle);
    border-color: var(--border);
}

html[data-theme="dark"] .fulfillment-step-btn {
    color: var(--text-muted);
}

html[data-theme="dark"] .fulfillment-step-btn:hover:not(:disabled) {
    background: var(--primary-soft);
    color: var(--primary-hover);
}

html[data-theme="dark"] .fulfillment-step-btn.active {
    background: var(--primary);
    color: #fff;
}

html[data-theme="dark"] .mixed-payment-panel {
    background: linear-gradient(180deg, rgba(99,102,241,0.18) 0%, var(--surface-2) 100%);
    border-color: var(--border);
}

html[data-theme="dark"] .modal-sheet-panel .form-control {
    background: var(--input-bg);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .dash-simple-header,
html[data-theme="dark"] .link-list a,
html[data-theme="dark"] .product-rank-item,
html[data-theme="dark"] .timeline-content {
    color: var(--text);
}

html[data-theme="dark"] .rank-bar {
    background: var(--bg-subtle);
}

html[data-theme="dark"] .page-loader,
html[data-theme="dark"] .sidebar-overlay.visible {
    background: var(--overlay);
}

html[data-theme="dark"] .invoice-details-page--sale .invoice-summary-card--status,
html[data-theme="dark"] .invoice-details-page--sale .invoice-summary-card--fulfillment {
    background: linear-gradient(180deg, var(--surface), rgba(99,102,241,0.12));
    border-color: rgba(129,140,248,0.28);
}

html[data-theme="dark"] .invoice-details-page--purchase .invoice-summary-card--status {
    background: linear-gradient(180deg, var(--surface), rgba(20,184,166,0.12));
    border-color: rgba(45,212,191,0.28);
}

html[data-theme="dark"] select.form-control option {
    background: var(--surface);
    color: var(--text);
}

html[data-theme="dark"] .btn-icon {
    color: var(--text-muted);
}

html[data-theme="dark"] .btn-icon:hover {
    background: var(--card-hover-bg);
    color: var(--text);
}

html[data-theme="dark"] .highlight-card:hover,
html[data-theme="dark"] .dash-stats .stat-card:hover,
html[data-theme="dark"] .mini-stat:hover,
html[data-theme="dark"] .warehouse-stat-card:hover,
html[data-theme="dark"] .profile-action-card:hover,
html[data-theme="dark"] .dash-quick-link:hover,
html[data-theme="dark"] .invoice-summary-card:hover,
html[data-theme="dark"] .dashboard-layout-option:hover,
html[data-theme="dark"] .fab-sheet-option:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
}

html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-ghost:hover {
    background: var(--btn-hover-bg);
}

html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination span {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .invoice-document--sale .invoice-brand-mark {
    color: var(--primary-hover);
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.28), rgba(99, 102, 241, 0.12));
    border-color: rgba(129, 140, 248, 0.35);
}

html[data-theme="dark"] .invoice-document--purchase .invoice-brand-mark {
    color: #5eead4;
    background: linear-gradient(160deg, rgba(20, 184, 166, 0.22), rgba(20, 184, 166, 0.1));
    border-color: rgba(45, 212, 191, 0.35);
}

html[data-theme="dark"] .invoice-document--sale .invoice-grand-total {
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.18), var(--surface-2));
    border-color: var(--border);
}

html[data-theme="dark"] .invoice-document--sale .invoice-grand-total strong {
    color: var(--primary-hover);
}

html[data-theme="dark"] .invoice-document--purchase .invoice-grand-total {
    background: linear-gradient(160deg, rgba(20, 184, 166, 0.15), var(--surface-2));
    border-color: var(--border);
}

html[data-theme="dark"] .invoice-watermark {
    color: rgba(148, 163, 184, 0.08);
}

html[data-theme="dark"] .text-warning { color: var(--warning-text); }
html[data-theme="dark"] .text-success { color: var(--success-text); }
html[data-theme="dark"] .text-danger { color: var(--danger-text); }

html[data-theme="dark"] .pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Dark mode: icon boxes & action buttons */
html[data-theme="dark"] .dash-icon-box--blue { background: rgba(37, 99, 235, 0.18); color: #93c5fd; }
html[data-theme="dark"] .dash-icon-box--violet { background: rgba(124, 58, 237, 0.18); color: #c4b5fd; }
html[data-theme="dark"] .dash-icon-box--teal { background: rgba(13, 148, 136, 0.18); color: #5eead4; }
html[data-theme="dark"] .dash-icon-box--amber { background: rgba(217, 119, 6, 0.18); color: #fcd34d; }

html[data-theme="dark"] .page-header-icon {
    background: var(--primary-soft);
    color: var(--primary-hover);
}

html[data-theme="dark"] .btn-icon {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
}

html[data-theme="dark"] .btn-icon:hover:not(:disabled) {
    background: var(--surface);
    color: var(--text);
}

html[data-theme="dark"] .btn-icon-return:hover:not(:disabled) {
    border-color: #f59e0b;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.12);
}

html[data-theme="dark"] .btn-icon-sale:hover:not(:disabled),
html[data-theme="dark"] .btn-icon-complete:hover:not(:disabled) {
    border-color: #34d399;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.12);
}

html[data-theme="dark"] .btn-icon-edit:hover:not(:disabled),
html[data-theme="dark"] .btn-icon-view:hover:not(:disabled),
html[data-theme="dark"] .btn-icon-payment:hover:not(:disabled),
html[data-theme="dark"] .btn-icon-report:hover:not(:disabled),
html[data-theme="dark"] .btn-icon-purchase:hover:not(:disabled) {
    border-color: var(--primary-hover);
    color: var(--primary-hover);
    background: rgba(99, 102, 241, 0.15);
}

html[data-theme="dark"] .search-field-icon {
    color: var(--text-muted);
}

html[data-theme="dark"] .supplier-autocomplete-wrap.has-selection #supplierSearch,
html[data-theme="dark"] .customer-autocomplete-wrap.has-selection #customerSearch {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.12);
    color: var(--success-text);
}

html[data-theme="dark"] .invoice-create-form .invoice-partner-block,
html[data-theme="dark"] .invoice-create-form .invoice-line-picker,
html[data-theme="dark"] .product-lookup-info {
    background: var(--surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] .product-lookup-info {
    color: var(--primary-hover);
}

html[data-theme="dark"] .product-autocomplete-wrap .form-control.is-found,
html[data-theme="dark"] .product-title-display.is-found {
    background: rgba(22, 163, 74, 0.12);
    border-color: var(--success);
    color: var(--success-text);
}

html[data-theme="dark"] .product-title-display.is-error,
html[data-theme="dark"] .product-lookup-info.is-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-text);
}

html[data-theme="dark"] .payment-method-option:has(input:checked) {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-hover);
}

html[data-theme="dark"] .nav-item:not(.active) .nav-icon {
    color: var(--text-muted);
}

html[data-theme="dark"] .nav-item:not(.active):hover .nav-icon {
    color: var(--text);
}

.platform-dashboard-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.platform-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.platform-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.platform-card-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.platform-card strong {
    display: block;
    margin-bottom: 0.25rem;
}

.platform-card span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-grid-2,
.form-grid-3 {
    display: grid;
    gap: 1rem;
}

.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-full { grid-column: 1 / -1; }

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3 { grid-template-columns: 1fr; }
}

.stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary, var(--text-muted));
}

.stats-inline strong {
    color: var(--text);
    font-weight: 600;
}

/* —— Platform tenant edit —— */
.tenant-edit-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1100px;
}

.tenant-edit-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-soft, #eef5ff) 70%, transparent), transparent 70%),
        var(--surface, #fff);
}

.tenant-edit-hero-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.tenant-edit-hero-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    color: var(--primary);
    flex-shrink: 0;
}

.tenant-edit-hero-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.tenant-edit-hero-icon--logo {
    padding: 0;
    overflow: hidden;
    background: var(--surface, #fff);
}

.tenant-logo-img,
.tenant-logo-preview img,
.tenant-list-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tenant-logo-img {
    width: 3rem;
    height: 3rem;
}

.tenant-logo-upload {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.tenant-logo-preview {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2, #f8fafc);
    overflow: hidden;
    flex-shrink: 0;
    padding: 0.35rem;
}

.tenant-logo-controls {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tenant-logo-remove {
    margin-top: 0.25rem;
}

.tenant-list-logo-cell {
    width: 48px;
}

.tenant-list-logo,
.tenant-list-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2, #f8fafc);
    object-fit: contain;
    padding: 0.2rem;
}

.tenant-list-logo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.tenant-list-logo-placeholder svg {
    width: 16px;
    height: 16px;
}

.tenant-edit-hero-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.tenant-edit-hero-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.tenant-edit-hero-meta {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.tenant-edit-dot {
    opacity: 0.5;
}

.tenant-usage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.tenant-usage-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    background: var(--surface, #fff);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tenant-usage-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.tenant-usage-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.tenant-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tenant-edit-section {
    overflow: hidden;
}

.tenant-edit-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.35rem 0.25rem;
}

.tenant-edit-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.tenant-edit-section-desc {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tenant-edit-section-body--flush {
    padding-top: 0.5rem;
}

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

.tenant-limit-field .form-hint {
    margin-top: 0.35rem;
}

.tenant-status-field {
    margin-top: 0.15rem;
}

.tenant-status-toggle {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    background: var(--bg-muted, #f8fafc);
    cursor: pointer;
    margin: 0;
    position: relative;
    width: 100%;
}

.form-group .tenant-status-toggle {
    display: flex;
    margin-bottom: 0;
}

.tenant-status-toggle input[type="checkbox"],
.tenant-status-toggle input[type="hidden"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tenant-status-toggle-ui {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.tenant-status-toggle-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 15%);
    transition: inset-inline-start 0.15s ease;
}

.tenant-status-toggle input[type="checkbox"]:checked ~ .tenant-status-toggle-ui {
    background: var(--primary);
}

.tenant-status-toggle input[type="checkbox"]:checked ~ .tenant-status-toggle-ui::after {
    inset-inline-start: calc(100% - 21px);
}

.tenant-status-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tenant-status-toggle-copy strong {
    font-size: 0.92rem;
    color: var(--text);
}

.tenant-status-toggle-copy small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.tenant-edit-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0.75rem;
    z-index: 5;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    background: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgb(15 23 42 / 8%);
}

.tenant-module-matrix {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.tenant-module-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    background: var(--surface, #fff);
    padding: 0.95rem 1rem;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tenant-module-row.is-enabled {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: color-mix(in srgb, var(--primary-soft, #eef5ff) 45%, var(--surface, #fff));
    box-shadow: inset 3px 0 0 var(--primary);
}

.tenant-module-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.tenant-module-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.tenant-module-icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--bg-muted, #f8fafc);
    border: 1px solid var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
}

.tenant-module-row.is-enabled .tenant-module-icon {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary-soft, #eef5ff) 80%, #fff);
    border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}

.tenant-module-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.tenant-module-text {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.tenant-module-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.tenant-module-key {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tenant-module-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    margin: 0;
    flex-shrink: 0;
}

.tenant-module-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.tenant-module-switch-ui {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.tenant-module-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 15%);
    transition: transform 0.15s ease;
}

.tenant-module-switch input[type="checkbox"]:checked ~ .tenant-module-switch-ui {
    background: var(--primary);
}

.tenant-module-switch input[type="checkbox"]:checked ~ .tenant-module-switch-ui::after {
    transform: translateX(18px);
}

[dir="rtl"] .tenant-module-switch input[type="checkbox"]:checked ~ .tenant-module-switch-ui::after {
    transform: translateX(-18px);
}

.tenant-module-switch-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 3.2rem;
}

.tenant-module-advanced {
    margin-top: 0.75rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.35rem;
}

.tenant-module-advanced > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.35rem 0;
    user-select: none;
}

.tenant-module-advanced > summary::-webkit-details-marker {
    display: none;
}

.tenant-module-advanced > summary::after {
    content: " ⌄";
    opacity: 0.7;
}

.tenant-module-advanced[open] > summary::after {
    content: " ⌃";
}

.tenant-module-row-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    padding-top: 0.35rem;
}

.tenant-module-row-meta .form-group {
    margin: 0;
}

.tenant-module-row-meta label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.tenant-module-usage {
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-muted, #f8fafc);
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 960px) {
    .tenant-usage-grid,
    .tenant-module-matrix {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tenant-usage-grid,
    .tenant-module-matrix,
    .tenant-limits-grid,
    .tenant-module-row-meta {
        grid-template-columns: 1fr;
    }

    .tenant-edit-actions {
        position: static;
    }
}

.sidebar-main-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-platform-panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
    flex-direction: column;
}

.sidebar-platform-panel::-webkit-scrollbar {
    width: 4px;
}

.sidebar-platform-panel::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-platform-panel::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.sidebar--platform-mode .sidebar-main-panel {
    display: none !important;
}

.sidebar--platform-mode .sidebar-platform-panel {
    display: flex;
}

.sidebar-platform-toggle {
    margin-right: auto;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-platform-toggle:hover,
.sidebar-platform-toggle.is-active {
    background: rgba(99, 102, 241, 0.22);
    color: #e2e8f0;
}

.sidebar-platform-toggle .nav-icon,
.sidebar-platform-toggle svg {
    width: 18px;
    height: 18px;
}

.sidebar-tenant-context {
    width: 100%;
    margin-bottom: 0.35rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    font-size: 0.72rem;
    color: #fcd34d;
}

.sidebar-tenant-context strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: #fde68a;
}

.topbar-tenant-badge {
    display: inline-flex;
    align-items: center;
    max-width: 160px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning, #b45309);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-tenant-current {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.profile-tenant-form .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.platform-settings-page {
    margin-top: 0.75rem;
}

.platform-month-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
}

.platform-month-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    background: var(--surface, #fff);
}

.platform-month-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.platform-month-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.platform-month-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.platform-delta {
    font-size: 0.75rem;
    font-weight: 600;
}

.platform-delta--up { color: var(--success, #16a34a); }
.platform-delta--down { color: var(--danger, #dc2626); }
.platform-delta--flat { color: var(--text-muted); }

.platform-report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.platform-alert-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

@media (max-width: 1100px) {
    .platform-month-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .platform-report-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .platform-month-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Platform monitoring ── */
.monitor-page {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.monitor-block-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.monitor-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-soft, #eef5ff) 55%, transparent), transparent 62%),
        var(--surface, #fff);
    border-inline-start-width: 4px;
    box-shadow: 0 10px 28px rgb(15 23 42 / 4%);
}

.monitor-hero.monitor-status--ok {
    border-inline-start-color: var(--success, #16a34a);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--success, #16a34a) 10%, transparent), transparent 58%),
        var(--surface, #fff);
}
.monitor-hero.monitor-status--warn {
    border-inline-start-color: #d97706;
    background:
        linear-gradient(135deg, color-mix(in srgb, #d97706 12%, transparent), transparent 58%),
        var(--surface, #fff);
}
.monitor-hero.monitor-status--bad {
    border-inline-start-color: var(--danger, #dc2626);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--danger, #dc2626) 10%, transparent), transparent 58%),
        var(--surface, #fff);
}
.monitor-hero.monitor-status--unknown { border-inline-start-color: var(--text-muted); }

.monitor-hero-title {
    font-size: 1.15rem;
    font-weight: 750;
    color: var(--text);
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.monitor-refresh {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface, #fff) 88%, var(--surface-2, #f8fafc));
}

.monitor-refresh-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0;
}

.monitor-refresh-select {
    width: auto;
    min-width: 7.5rem;
    padding: 0.28rem 0.5rem;
    font-size: 0.8rem;
    height: auto;
}

.monitor-refresh-countdown {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--primary, #2563eb);
    font-weight: 650;
    min-width: 3.5rem;
}

.monitor-page .stat-card {
    border-radius: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.monitor-page .stat-card:hover {
    box-shadow: 0 8px 20px rgb(15 23 42 / 5%);
}

.monitor-page .monitor-link-card {
    border-radius: 14px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.monitor-page .monitor-link-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgb(15 23 42 / 6%);
}

.monitor-hero-main {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    flex: 1 1 16rem;
}

.monitor-hero-badge {
    display: inline-flex;
    width: fit-content;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--border) 55%, transparent);
}

.monitor-status--ok .monitor-hero-badge,
.monitor-pill.monitor-status--ok {
    color: var(--success, #16a34a);
    background: color-mix(in srgb, var(--success, #16a34a) 14%, transparent);
}

.monitor-status--warn .monitor-hero-badge,
.monitor-pill.monitor-status--warn {
    color: #b45309;
    background: color-mix(in srgb, #d97706 16%, transparent);
}

.monitor-status--bad .monitor-hero-badge,
.monitor-pill.monitor-status--bad {
    color: var(--danger, #dc2626);
    background: color-mix(in srgb, var(--danger, #dc2626) 14%, transparent);
}

.monitor-hero-title {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.45;
}

.monitor-hero-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.monitor-hero-side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.monitor-hero-chip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    min-width: 5.5rem;
    background: var(--surface-2, transparent);
}

.monitor-hero-chip span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.monitor-hero-chip strong {
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.monitor-alerts {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface, #fff);
    overflow: hidden;
}

.monitor-alerts .card-header {
    margin: 0;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.monitor-alert-list {
    list-style: none;
    margin: 0;
    padding: 0.85rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.monitor-alert {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm, 10px);
    border: 1px solid var(--border);
}

.monitor-alert.monitor-status--warn {
    border-color: color-mix(in srgb, #d97706 40%, var(--border));
    background: color-mix(in srgb, #d97706 8%, transparent);
}

.monitor-alert.monitor-status--bad {
    border-color: color-mix(in srgb, var(--danger, #dc2626) 40%, var(--border));
    background: color-mix(in srgb, var(--danger, #dc2626) 8%, transparent);
}

.monitor-alert small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.stat-card.monitor-status--ok {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success, #16a34a) 28%, transparent);
}

.stat-card.monitor-status--warn {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #d97706 35%, transparent);
}

.stat-card.monitor-status--bad {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger, #dc2626) 35%, transparent);
}

.monitor-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.monitor-hangfire-grid,
.monitor-storage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.monitor-equal-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    margin: 0;
}

.monitor-equal-card > .card-body,
.monitor-equal-card > .table-responsive {
    flex: 1 1 auto;
}

.monitor-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.75rem;
}

.monitor-health-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface, #fff);
    box-shadow: inset 0 0 0 1px transparent;
}

.monitor-health-card.monitor-status--ok {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success, #16a34a) 28%, transparent);
}
.monitor-health-card.monitor-status--warn {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #d97706 35%, transparent);
}
.monitor-health-card.monitor-status--bad {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger, #dc2626) 35%, transparent);
}

.monitor-health-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.monitor-health-value {
    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.35;
    color: var(--text);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.monitor-health-meta {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.monitor-kv-text {
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.monitor-detail-grid > .card {
    margin: 0;
    min-width: 0;
}

.monitor-detail-grid .card-header,
.monitor-page .data-list-card > .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.monitor-detail-grid .card-header h2,
.monitor-page .data-list-card > .card-header h2 {
    margin: 0;
}

.monitor-code {
    font-size: 0.78rem;
    word-break: break-all;
}

.monitor-pill {
    display: inline-flex;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.monitor-fail-reason {
    max-width: 28rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.monitor-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.monitor-kv {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.monitor-kv .stat-label {
    margin: 0;
}

.monitor-kv strong {
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.monitor-kv--full {
    grid-column: 1 / -1;
}

.monitor-kv small {
    display: block;
    margin-top: 0.2rem;
}

.monitor-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.monitor-link-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface, #fff);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.monitor-link-card:hover {
    border-color: var(--primary, #2563eb);
    background: var(--surface-2, var(--bg));
}

.monitor-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    color: var(--text-muted);
}

.monitor-link-icon svg {
    width: 18px;
    height: 18px;
}

.monitor-link-card strong {
    display: block;
    font-size: 0.9rem;
}

.monitor-link-card small {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.backup-messenger-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.backup-messenger-actions .form-hint {
    flex: 1 1 100%;
    margin: 0;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ── Platform users ── */
.platform-users-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2, transparent);
}

.platform-users-filters .warehouse-filter-tabs {
    margin-bottom: 0;
}

.platform-users-count {
    margin-inline-start: auto;
    font-size: 0.8rem;
}

.platform-user-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.platform-user-org {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.platform-user-org:hover {
    color: var(--primary, #2563eb);
}

.platform-user-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.platform-user-header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.platform-user-header-actions .btn svg {
    width: 16px;
    height: 16px;
}

.tenant-edit-page .menu-checkboxes {
    margin-top: 0.85rem;
}

.tenant-usage-card .tenant-usage-value {
    word-break: break-word;
}

@media (max-width: 640px) {
    .platform-users-count {
        width: 100%;
        margin-inline-start: 0;
    }

    .platform-user-header-actions {
        width: 100%;
    }

    .platform-user-header-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 960px) {
    .monitor-detail-grid,
    .monitor-hangfire-grid,
    .monitor-storage-grid,
    .monitor-links {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 640px) {
    .monitor-hero-side {
        width: 100%;
    }

    .monitor-hero-side .btn,
    .monitor-refresh {
        width: 100%;
    }

    .monitor-refresh {
        justify-content: space-between;
    }

    .monitor-refresh-select {
        flex: 1 1 auto;
        min-width: 0;
    }

    .monitor-detail-grid,
    .monitor-hangfire-grid,
    .monitor-storage-grid,
    .monitor-kv-grid,
    .monitor-links,
    .monitor-health-grid {
        grid-template-columns: 1fr;
    }

    .monitor-fail-reason {
        max-width: none;
    }

    .monitor-page .data-table td,
    .monitor-page .data-table th {
        white-space: normal;
    }

    .monitor-code {
        font-size: 0.72rem;
    }

    .backup-files-header {
        flex-direction: column;
        align-items: stretch;
    }

    .backup-upload-form {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ── PWA Install ── */
.sidebar-pwa-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 0.5rem 0.35rem 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.1));
    color: #e2e8f0;
    text-align: right;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
}

.sidebar-pwa-card:hover {
    border-color: rgba(129, 140, 248, 0.65);
    transform: translateY(-1px);
}

.sidebar-pwa-card-glow {
    position: absolute;
    inset: -40% auto auto -20%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.35), transparent 70%);
    pointer-events: none;
}

.sidebar-pwa-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.35);
    color: #c7d2fe;
    flex-shrink: 0;
}

.sidebar-pwa-card-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-pwa-card-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-pwa-card-text strong {
    font-size: 0.78rem;
    font-weight: 700;
}

.sidebar-pwa-card-text small {
    font-size: 0.65rem;
    color: #94a3b8;
}

.sidebar-pwa-card-arrow {
    display: flex;
    color: #818cf8;
    transform: rotate(180deg);
    flex-shrink: 0;
}

.sidebar-pwa-card-arrow svg {
    width: 16px;
    height: 16px;
}

.login-pwa-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-soft), transparent);
    color: var(--text);
    text-align: right;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-pwa-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

.login-pwa-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}

.login-pwa-card-icon svg {
    width: 20px;
    height: 20px;
}

.login-pwa-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.login-pwa-card-text strong {
    font-size: 0.88rem;
}

.login-pwa-card-text small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pwa-install-banner {
    position: fixed;
    z-index: 11000;
    inset-inline: auto 1.25rem;
    bottom: 1.25rem;
    width: min(420px, calc(100vw - 2rem));
    max-width: 420px;
    margin-inline: 0;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.pwa-install-banner.is-visible {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0);
    pointer-events: auto;
}

@media (max-width: 1024px) {
    .pwa-install-banner {
        inset-inline: 1rem;
        bottom: calc(var(--bottom-nav-height, 52px) + env(safe-area-inset-bottom) + 1rem);
        margin-inline: auto;
    }
}

.pwa-install-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(12px);
}

[data-theme="light"] .pwa-install-banner-inner {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.96));
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.pwa-install-banner-icon img {
    border-radius: 10px;
    display: block;
}

.pwa-install-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: #f1f5f9;
}

[data-theme="light"] .pwa-install-banner-text {
    color: var(--text);
}

.pwa-install-banner-text strong {
    font-size: 0.85rem;
}

.pwa-install-banner-text span {
    font-size: 0.72rem;
    color: #94a3b8;
}

.pwa-install-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.pwa-banner-snooze {
    min-width: 32px;
    padding-inline: 0.4rem;
    font-size: 1.1rem;
    line-height: 1;
}

.pwa-install-sheet {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.pwa-install-sheet:not([hidden]) {
    pointer-events: auto;
}

.pwa-install-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.pwa-install-sheet.is-open .pwa-install-sheet-backdrop {
    opacity: 1;
}

.pwa-install-sheet-panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(92vh, 780px);
    overflow: auto;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 -20px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 640px) {
    .pwa-install-sheet {
        align-items: center;
        padding: 1rem;
    }

    .pwa-install-sheet-panel {
        border-radius: 20px;
        transform: translateY(24px) scale(0.96);
        opacity: 0;
    }

    .pwa-install-sheet.is-open .pwa-install-sheet-panel {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.pwa-install-sheet.is-open .pwa-install-sheet-panel {
    transform: translateY(0);
}

.pwa-install-sheet-close {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
}

.pwa-install-sheet-close svg {
    width: 18px;
    height: 18px;
}

.pwa-install-sheet-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-top: 0.25rem;
}

.pwa-install-sheet-logo img {
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.pwa-install-sheet-title {
    margin: 0;
    font-size: 1.15rem;
}

.pwa-install-sheet-tagline {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pwa-install-sheet-tabs {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.pwa-install-sheet-tabs::-webkit-scrollbar {
    display: none;
}

.pwa-install-tab {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pwa-install-tab.is-active {
    background: var(--primary-soft);
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--primary);
}

.pwa-guide-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 520px) {
    .pwa-guide-layout {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: center;
    }
}

.pwa-guide-copy h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.pwa-guide-subtitle {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pwa-guide-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.pwa-guide-step {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.pwa-guide-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.pwa-guide-step-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.pwa-guide-step-body strong {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.45;
}

.pwa-guide-step-body small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pwa-guide-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 0.75rem;
    border-radius: 16px;
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
}

.pwa-mock-device {
    width: 100%;
    max-width: 200px;
}

.pwa-mock-screen,
.pwa-mock-window {
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(148, 163, 184, 0.35);
    background: #0f172a;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.pwa-mock-url {
    padding: 0.35rem 0.5rem;
    font-size: 0.55rem;
    text-align: center;
    color: #94a3b8;
    background: #1e293b;
}

.pwa-mock-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    font-size: 0.55rem;
    color: #cbd5e1;
    background: #1e293b;
}

.pwa-mock-menu {
    font-size: 0.85rem;
    color: #818cf8;
}

.pwa-mock-content {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1e293b, #0f172a);
}

.pwa-mock-content img {
    border-radius: 12px;
}

.pwa-mock-content--desktop {
    min-height: 120px;
    flex-direction: column;
    gap: 0.5rem;
    color: #94a3b8;
    font-size: 0.65rem;
}

.pwa-mock-ios-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    background: #1e293b;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.pwa-mock-ios-share {
    display: flex;
    color: #818cf8;
}

.pwa-mock-ios-share svg {
    width: 18px;
    height: 18px;
}

.pwa-mock-banner {
    margin: 0.5rem;
    padding: 0.35rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.35);
}

.pwa-mock-titlebar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    background: #1e293b;
}

.pwa-mock-titlebar span:first-child,
.pwa-mock-titlebar span:nth-child(2),
.pwa-mock-titlebar span:nth-child(3) {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
}

.pwa-mock-address {
    flex: 1;
    margin-right: 0.35rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    background: #0f172a;
    font-size: 0.55rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pwa-mock-install {
    color: #818cf8;
    font-weight: 700;
}

.pwa-mock-menubar {
    display: flex;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.55rem;
    color: #cbd5e1;
    background: #1e293b;
    border-radius: 8px 8px 0 0;
}

.pwa-mock-pulse {
    animation: pwa-mock-pulse 1.8s ease-in-out infinite;
}

@keyframes pwa-mock-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(1.06); }
}

.pwa-install-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pwa-native-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pwa-native-btn svg {
    width: 18px;
    height: 18px;
}

.pwa-dismiss-link {
    font-size: 0.78rem;
    color: var(--text-muted);
}

body.pwa-sheet-open {
    overflow: hidden;
}

.login-page .pwa-install-banner {
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

@media (display-mode: standalone),
       (display-mode: window-controls-overlay) {
    .sidebar-pwa-card,
    .login-pwa-card,
    .pwa-install-banner,
    .pwa-install-sheet {
        display: none !important;
    }
}


/* -- Impersonation banner -- */
.impersonation-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.65rem 1rem;
    background: color-mix(in srgb, var(--warning, #d97706) 14%, var(--surface, #fff));
    border-bottom: 1px solid color-mix(in srgb, var(--warning, #d97706) 35%, var(--border));
    color: var(--text);
}

.impersonation-banner__text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.impersonation-banner .btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .impersonation-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .impersonation-banner .btn {
        width: 100%;
        justify-content: center;
    }
}

/* -- Connectivity (offline / online) -- */
.connectivity-banner {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
    background:
        linear-gradient(135deg, color-mix(in srgb, #b45309 18%, var(--surface, #fff)), var(--surface, #fff));
    border-bottom: 1px solid color-mix(in srgb, #b45309 40%, var(--border));
    color: var(--text);
    box-shadow: 0 10px 28px rgb(15 23 42 / 10%);
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.connectivity-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.connectivity-banner__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: color-mix(in srgb, #b45309 14%, var(--surface, #fff));
    color: #b45309;
    border: 1px solid color-mix(in srgb, #b45309 28%, var(--border));
}

.connectivity-banner__icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.connectivity-banner__copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.connectivity-banner__copy strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.connectivity-banner__copy span {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.connectivity-banner.is-shake {
    animation: connectivity-shake 0.45s ease;
}

@keyframes connectivity-shake {
    0%, 100% { transform: translateY(0); }
    20% { transform: translateY(0) translateX(4px); }
    40% { transform: translateY(0) translateX(-4px); }
    60% { transform: translateY(0) translateX(3px); }
    80% { transform: translateY(0) translateX(-2px); }
}

.connectivity-toast {
    position: fixed;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    z-index: 1210;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: min(20rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: color-mix(in srgb, var(--success, #059669) 12%, var(--surface, #fff));
    border: 1px solid color-mix(in srgb, var(--success, #059669) 35%, var(--border));
    color: var(--text);
    box-shadow: 0 14px 36px rgb(15 23 42 / 14%);
    transform: translate(-50%, 120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.connectivity-toast.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.connectivity-toast__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--success, #059669) 16%, var(--surface, #fff));
    color: var(--success, #059669);
    border: 1px solid color-mix(in srgb, var(--success, #059669) 28%, var(--border));
}

.connectivity-toast__icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.connectivity-toast__copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.connectivity-toast__copy strong {
    font-size: 0.92rem;
    font-weight: 700;
}

.connectivity-toast__copy span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

body.is-offline .page-content {
    padding-top: 0.35rem;
}

html[data-theme="dark"] .connectivity-banner {
    background:
        linear-gradient(135deg, color-mix(in srgb, #f59e0b 22%, #0b1220), #0b1220);
}

html[data-theme="dark"] .connectivity-toast {
    background: color-mix(in srgb, #34d399 16%, #0b1220);
    box-shadow: 0 14px 36px rgb(0 0 0 / 35%);
}

@media (max-width: 640px) {
    .connectivity-toast {
        bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ─── iPhone SE / narrow phones (≤390px) — keep after other mobile rules ─── */
@media (max-width: 390px) {
    .stats-grid,
    .reports-stats,
    .reports-order-stats,
    .reports-highlight,
    .platform-month-grid,
    .mini-stats-row,
    .tenant-usage-grid,
    .tenant-module-matrix,
    .tenant-limits-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding-inline: 0.65rem;
    }

    .card-header {
        padding: 0.85rem 0.9rem;
    }

    .card-header h2 {
        font-size: 0.95rem;
    }

    .data-list-toolbar {
        padding: 0.75rem 0.85rem;
    }
}

/* ─── Guide Tour ─── */
body.tour-open {
    overflow: hidden;
}

.tour-root {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
    display: none;
}

.tour-root.is-active {
    display: block;
    pointer-events: auto;
}

.tour-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.tour-spotlight {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
    border: 2px solid var(--accent, #0ea5e9);
    background: transparent;
    pointer-events: none;
    transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
    z-index: 1;
}

.tour-target-active {
    position: relative;
    z-index: 12001 !important;
    border-radius: 10px;
}

.tour-popover {
    position: fixed;
    z-index: 2;
    width: min(360px, calc(100vw - 1.5rem));
    background: var(--card-bg, #fff);
    color: var(--text, #0f172a);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    padding: 1rem 1.05rem 0.9rem;
    direction: rtl;
}

.tour-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.tour-popover-header strong {
    font-size: 0.98rem;
    font-weight: 750;
}

.tour-step-count {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}

.tour-popover-text {
    margin: 0 0 0.95rem;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-muted, #64748b);
}

.tour-popover-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.tour-popover-nav {
    display: flex;
    gap: 0.4rem;
}

.topbar-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.profile-action-card--button {
    width: 100%;
    text-align: right;
    font: inherit;
    cursor: pointer;
    appearance: none;
}

.topbar-tour-btn svg {
    width: 16px;
    height: 16px;
}

.topbar-tour-label {
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .topbar-tour-label { display: none; }
}

html[data-theme="dark"] .tour-overlay {
    background: rgba(2, 6, 23, 0.72);
}

html[data-theme="dark"] .tour-spotlight {
    box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.72);
    border-color: #38bdf8;
}

html[data-theme="dark"] .tour-popover {
    background: var(--card-bg, #0f172a);
    border-color: var(--border, #1e293b);
}
