/* ═══════════════════════════════════════════════════════
   CORE ERP — Global Stylesheet
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg: #080b1a;
    --page-bg: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 70% 0%, rgba(139, 92, 246, 0.05) 0%, transparent 35%),
        linear-gradient(180deg, #080b1a 0%, #090d1d 100%);
    --sidebar-bg: #0c1022;
    --card: rgba(255, 255, 255, 0.04);
    --card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --primary: #6366f1;
    --primary-soft: rgba(99, 102, 241, 0.15);
    --primary-hover: #7c3aed;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --muted: #475569;
    --topbar-bg: rgba(8, 11, 26, 0.7);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --modal-bg: #111828;
    --modal-header-bg: linear-gradient(180deg, rgba(17, 24, 40, 0.98), rgba(17, 24, 40, 0.95));
    --popover-bg: #0b1020;
    --input-bg: rgba(255, 255, 255, 0.05);
    --option-bg: #1e2133;
    --soft-bg: rgba(255, 255, 255, 0.04);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html[data-theme='light'] {
    --bg: #f4f7fb;
    --page-bg: radial-gradient(ellipse at 20% 10%, rgba(99, 102, 241, 0.11) 0%, transparent 42%),
        radial-gradient(ellipse at 80% 0%, rgba(6, 182, 212, 0.08) 0%, transparent 32%),
        linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
    --sidebar-bg: #ffffff;
    --card: rgba(255, 255, 255, 0.92);
    --card-hover: rgba(15, 23, 42, 0.04);
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);
    --primary: #4f46e5;
    --primary-soft: rgba(79, 70, 229, 0.1);
    --secondary: #7c3aed;
    --accent: #0891b2;
    --text: #0f172a;
    --text-dim: #475569;
    --muted: #94a3b8;
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    --topbar-bg: rgba(255, 255, 255, 0.8);
    --overlay-bg: rgba(15, 23, 42, 0.25);
    --modal-bg: #ffffff;
    --modal-header-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.95));
    --popover-bg: #ffffff;
    --input-bg: rgba(255, 255, 255, 0.95);
    --option-bg: #ffffff;
    --soft-bg: rgba(15, 23, 42, 0.03);
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--page-bg);
    color: var(--text);
    font-size: 14px;
    direction: ltr;
}

html[dir="rtl"] body {
    direction: rtl;
}

/* ── Flat SVG icons ── */
.icon-flat {
    display: inline-block;
    vertical-align: -3px;
    flex: 0 0 auto;
}

.icon-flat-lg {
    vertical-align: -6px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

/* ── Layout ── */
#app {
    display: flex;
    height: 100vh;
}

/* ── Login Page ── */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    background: var(--page-bg);
    padding: 16px;
}

.login-box {
    width: 400px;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 44px;
    box-shadow: var(--shadow);
}

.login-box-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo {
    text-align: left;
    margin-bottom: 0;
}

html[dir="rtl"] .login-logo {
    text-align: right;
}

.login-logo .brand {
    font-size: 28px;
    font-weight: 800;
}

.brand.company-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.brand.company-brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.brand.company-brand .brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
}

.login-logo .brand span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo p {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 6px;
}

/* ── Sidebar ── */
#sidebar {
    width: 230px;
    min-width: 230px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 5;
}

html[dir="rtl"] #sidebar {
    border-right: 0;
    border-left: 1px solid var(--border);
}

.sidebar-logo {
    padding: 24px 20px 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .brand {
    font-size: 18px;
    font-weight: 800;
    max-width: 180px;
}

.sidebar-logo .brand span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo .brand.company-brand .brand-text,
.sidebar-logo .brand.company-brand .brand-text {
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: currentColor;
}

.sidebar-logo .sub {
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.sidebar-logo .brand.company-brand img {
    width: 28px;
    height: 28px;
}

nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-dim);
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--card-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--text);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 20px;
    font-weight: 700;
}

html[dir="rtl"] .nav-badge {
    margin-left: 0;
    margin-right: auto;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.user-chip .info .name {
    font-size: 12px;
    font-weight: 600;
}

.user-chip .info .role-tag {
    font-size: 10px;
    color: var(--muted);
}

.logout-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

html[dir="rtl"] .logout-btn {
    margin-left: 0;
    margin-right: auto;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ── Main ── */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ── Topbar ── */
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

#topbar h1 {
    font-size: 18px;
    font-weight: 700;
}

#topbar .sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Content ── */
#content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-control[type="color"] {
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

.form-control[type="file"] {
    padding: 8px 12px;
}

select.form-control option {
    background: var(--option-bg);
    color: var(--text);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 8px;
    align-items: stretch;
}

.input-action .btn {
    white-space: nowrap;
    min-width: 116px;
    justify-content: center;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── Buttons ── */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--card-hover);
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.theme-toggle-btn:hover {
    background: var(--card-hover);
    border-color: var(--primary);
}

.theme-toggle-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.theme-toggle-btn span {
    line-height: 1;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px;
    border-radius: var(--radius-sm);
}

/* ── Cards ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.card-sm {
    padding: 14px;
}

/* ── Product wizard ── */
.product-wizard {
    min-width: min(860px, 82vw);
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-dim);
    cursor: pointer;
    font: inherit;
    text-align: start;
}

.wizard-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--card-hover);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.wizard-step strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.wizard-step.active {
    border-color: var(--primary);
    color: var(--text);
    background: var(--primary-soft);
}

.wizard-step.active span {
    background: var(--primary);
    color: #fff;
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
}

.wizard-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0 14px;
}

.toggle-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.toggle-line input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.product-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.product-summary>div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.product-summary span,
.product-summary strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-summary strong {
    margin-top: 6px;
    color: var(--text);
}

.product-media-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.image-picker,
.gallery-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 196px;
    padding: 14px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    text-align: center;
}

.image-picker input,
.gallery-picker input {
    display: none;
}

.image-picker-preview {
    width: 118px;
    height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    overflow: hidden;
}

.image-picker-preview img,
.product-gallery-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-picker small {
    color: var(--text-dim);
    font-size: 12px;
}

.gallery-picker {
    min-height: 74px;
    flex-direction: row;
}

.product-gallery-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
    min-height: 82px;
    margin-top: 10px;
    align-items: center;
}

.product-gallery-item {
    position: relative;
    aspect-ratio: 1;
}

.product-gallery-preview img {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
}

.product-gallery-item img {
    display: block;
}

.product-gallery-item button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.88);
    color: #fff;
    cursor: pointer;
}

.product-code-preview {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--primary);
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.product-row {
    cursor: pointer;
}

.product-row:hover td {
    background: var(--card-hover);
}

.product-detail-view {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
    gap: 22px;
    align-items: start;
}

.product-detail-media {
    min-width: 0;
}

.product-detail-hero {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-thumbs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.product-detail-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--input-bg);
}

.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.product-detail-code {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.product-detail-info h2 {
    font-size: 26px;
    line-height: 1.2;
    margin: 6px 0 0;
}

.product-detail-price {
    color: var(--primary);
    font-size: 28px;
    font-weight: 900;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.product-detail-grid>div,
.product-detail-stock>div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.product-detail-grid span,
.product-detail-grid strong,
.product-detail-stock span,
.product-detail-stock strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-detail-grid span,
.product-detail-stock span {
    color: var(--text-dim);
    font-size: 11px;
    margin-bottom: 5px;
}

.product-detail-stock {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.product-detail-stock .card-title {
    grid-column: 1 / -1;
}

.product-detail-description {
    color: var(--text-dim);
    line-height: 1.6;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.purchase-detail-view {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.purchase-detail-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.purchase-detail-meta>div {
    min-width: 0;
}

.purchase-detail-meta span,
.purchase-detail-meta strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.purchase-detail-meta span {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 5px;
}

.product-tracking {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.product-group-prices {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.product-tracking-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.section-kicker {
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.product-tracking h3,
.product-tracking h4 {
    margin: 4px 0 0;
    color: var(--text);
}

.product-tracking h3 {
    font-size: 18px;
}

.product-tracking h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.product-tracking-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.product-tracking-kpis>div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.product-tracking-kpis span,
.product-tracking-kpis strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-tracking-kpis span {
    color: var(--text-dim);
    font-size: 11px;
    margin-bottom: 5px;
}

.product-tracking-kpis strong {
    font-size: 15px;
}

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

.product-tracking section {
    min-width: 0;
}

.product-tracking-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.product-tracking-section-head h4 {
    margin-bottom: 0;
}

.product-tracking-section-head span,
.product-tracking-pagination-summary {
    color: var(--text-dim);
    font-size: 12px;
}

.product-tracking-pagination-summary {
    margin-bottom: 10px;
}

.product-tracking-pagination {
    margin-top: 12px;
}

.table-wrap.compact {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.table-wrap.compact table {
    min-width: 680px;
}

.table-wrap.compact th,
.table-wrap.compact td {
    padding: 9px 10px;
    font-size: 12px;
}

.empty-inline {
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    background: var(--input-bg);
    text-align: center;
}

.product-label-preview-wrap {
    display: flex;
    justify-content: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    margin-top: 8px;
}

.category-tree-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.category-tree-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 34px;
}

.category-tree-row.child {
    color: var(--text-dim);
    padding-inline-start: 18px;
}

.category-tree-row.child::before {
    content: "";
    width: 8px;
    height: 8px;
    border-inline-start: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex: 0 0 8px;
}

.category-tree-children {
    margin-top: 6px;
}

.product-print-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    color: #111827;
    border: 1px solid #d1d5db;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.product-print-label.label-50x30 {
    width: 250px;
    height: 150px;
    padding: 14px 16px;
}

.product-print-label.label-40x20 {
    width: 220px;
    height: 110px;
    padding: 10px 12px;
}

.label-product-name {
    width: 100%;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-product-code {
    width: 100%;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-product-barcode {
    width: 100%;
    height: 48px;
    margin-top: 10px;
}

.label-barcode-svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: #000;
}

.label-40x20 .label-product-name {
    font-size: 11px;
}

.label-40x20 .label-product-code {
    margin-top: 3px;
    font-size: 10px;
}

.label-40x20 .label-product-barcode {
    height: 34px;
    margin-top: 6px;
}

.label-product-price {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 800;
}

.label-40x20 .label-product-price {
    margin-top: 3px;
    font-size: 10px;
}

/* ── KPI Cards ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
    cursor: default;
}

.kpi:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 18px;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.kpi-trend {
    font-size: 12px;
    margin-top: 6px;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

.trend-neu {
    color: var(--text-dim);
}

/* ── Stats Row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

tbody td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: var(--card-hover);
}

.th-actions {
    text-align: left;
}

.pagination-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.pagination-size,
.pagination-pages {
    display: flex;
    align-items: center;
}

.pagination-size {
    gap: 8px;
    color: var(--text-dim);
    font-size: 12px;
}

.pagination-size select {
    width: 72px;
    height: 34px;
    padding: 4px 8px;
}

.pagination-pages {
    gap: 0;
}

.pagination-pages .btn {
    border-radius: 0;
    min-width: 34px;
    min-height: 28px;
}

.pagination-pages .btn:first-child {
    border-radius: 8px 0 0 8px;
}

.pagination-pages .btn:last-child {
    border-radius: 0 8px 8px 0;
}

.pagination-ellipsis {
    pointer-events: none;
}

.customer-review-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-green {
    background: rgba(16, 185, 129, .12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, .2);
}

.badge-yellow {
    background: rgba(245, 158, 11, .12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, .2);
}

.badge-red {
    background: rgba(239, 68, 68, .12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, .2);
}

.badge-blue {
    background: rgba(99, 102, 241, .12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, .2);
}

.badge-gray {
    background: rgba(148, 163, 184, .1);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--modal-bg);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 0;
    min-width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: slideUp 0.25s;
    display: flex;
    flex-direction: column;
}

.modal-lg {
    min-width: 700px;
}

.modal-xl {
    width: min(1420px, calc(100vw - 48px));
    min-width: min(1100px, calc(100vw - 48px));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--modal-header-bg);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 6px;
}

.modal-close:hover {
    color: var(--text);
    background: var(--card);
}

.modal-body {
    padding: 28px;
    overflow: auto;
    min-height: 0;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 20px 28px 24px;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.alert-info {
    background: rgb(99, 102, 241, .1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

/* ── Search bar ── */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
}

/* ── Page header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

/* ── Loading ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-dim);
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── Toast ── */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    min-width: 280px;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s;
}

.toast-success {
    background: #052e16;
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.toast-error {
    background: #450a0a;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.toast-info {
    background: #1e1b4b;
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

/* ── Items Table in form ── */
.items-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}

.items-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 44px;
    gap: 8px;
    padding: 10px 12px;
    background: var(--soft-bg);
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 44px;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    align-items: center;
}

.item-row .form-control {
    padding: 7px 10px;
    font-size: 13px;
}

.item-total {
    font-weight: 700;
    color: var(--primary);
}

.sale-quick-add-row {
    display: grid;
    grid-template-columns: minmax(300px, 2fr) minmax(220px, 1fr) 110px minmax(150px, 180px) 92px;
    gap: 10px;
    align-items: end;
    margin-bottom: 6px;
}

.sale-quick-add-row .form-control,
.sale-quick-add-row .btn {
    height: 40px;
}

.sale-quick-add-row .btn {
    width: 100%;
    justify-content: center;
}

.sale-quick-add-action {
    display: flex;
    align-items: end;
}

.add-item-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px;
    cursor: pointer;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    border-top: 1px solid var(--border);
    transition: background 0.2s;
}

.add-item-btn:hover {
    background: var(--primary-soft);
}

/* ── Report Charts (CSS) ── */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 100px;
    padding: 0 4px;
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s;
    min-height: 4px;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-label {
    font-size: 9px;
    color: var(--text-dim);
}

/* ── Misc ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.text-sm {
    font-size: 12px;
}

.text-muted {
    color: var(--text-dim);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.w-full {
    width: 100%;
}

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

/* ── Reports Upgrade ── */
.reports-upgrade {
    display: grid;
    gap: 16px;
}

.ru-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.ru-hero h2,
.ru-report-head h3 {
    margin: 4px 0 6px;
    font-size: 22px;
}

.ru-hero p,
.ru-report-head p {
    margin: 0;
    color: var(--text-dim);
    max-width: 760px;
    line-height: 1.5;
}

.ru-hero-actions,
.ru-filter-summary,
.ru-chip-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ru-report-tools {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.ru-blueprint-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid rgba(245, 158, 11, .28);
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, .08);
}

.ru-blueprint-banner strong,
.ru-blueprint-banner span {
    display: block;
}

.ru-blueprint-banner span {
    color: var(--text-dim);
    margin-top: 3px;
}

.ru-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ru-sidebar {
    position: sticky;
    top: 0;
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-width: thin;
}

.ru-sidebar::-webkit-scrollbar {
    width: 8px;
}

.ru-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

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

.ru-catalog-group {
    display: grid;
    gap: 6px;
}

.ru-catalog-title {
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 0 4px;
}

.ru-report-link {
    width: 100%;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    padding: 10px;
    cursor: pointer;
}

.ru-report-link.active,
.ru-report-link:hover {
    border-color: var(--primary);
    background: var(--card-hover);
}

.ru-report-link strong,
.ru-report-link small {
    display: block;
}

.ru-report-link small {
    color: var(--text-dim);
    margin-top: 2px;
}

.ru-report-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
}

.ru-main {
    min-width: 0;
}

.ru-report-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.ru-customer-map-card.ru-gis-card {
    overflow: hidden;
    border-color: rgba(34, 211, 238, .32);
    background: #07111d;
    color: #d7f9ff;
    box-shadow: 0 22px 55px rgba(0, 0, 0, .36);
}

.ru-gis-topbar {
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(34, 211, 238, .22);
    background: linear-gradient(180deg, rgba(11, 25, 42, .98), rgba(8, 18, 31, .96));
}

.ru-gis-brand,
.ru-map-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ru-gis-brand strong,
.ru-gis-brand small {
    display: block;
}

.ru-gis-brand small {
    color: rgba(215, 249, 255, .62);
    font-size: 11px;
    margin-top: 2px;
}

.ru-gis-logo {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(34, 211, 238, .35);
    border-radius: 50%;
    color: #67e8f9;
    background: rgba(34, 211, 238, .12);
}

.ru-map-actions button,
.ru-map-pan button {
    border: 1px solid rgba(34, 211, 238, .22);
    color: rgba(215, 249, 255, .75);
    background: rgba(8, 24, 40, .82);
}

.ru-map-actions button {
    min-width: 38px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
}

.ru-gis-body {
    min-height: 580px;
}

.ru-map-actions button:hover,
.ru-map-pan button:hover {
    color: #67e8f9;
    border-color: rgba(34, 211, 238, .58);
    background: rgba(6, 182, 212, .15);
}

.ru-map-stage.ru-gis-stage {
    position: relative;
    min-height: 580px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(14, 165, 233, .16), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(16, 185, 129, .11), transparent 22%),
        linear-gradient(rgba(34, 211, 238, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, .055) 1px, transparent 1px),
        #061221;
    background-size: auto, auto, 32px 32px, 32px 32px, auto;
}

.ru-gis-search {
    position: absolute;
    z-index: 6;
    left: 18px;
    top: 18px;
    display: inline-flex;
    gap: 9px;
    align-items: center;
    min-width: 300px;
    padding: 10px 14px;
    border: 1px solid rgba(34, 211, 238, .28);
    border-radius: 999px;
    background: rgba(8, 27, 45, .86);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.ru-gis-search strong {
    font-size: 12px;
}

.ru-gis-search em {
    margin-left: auto;
    color: rgba(215, 249, 255, .58);
    font-size: 11px;
    font-style: normal;
}

.ru-customer-map-viewport {
    position: absolute;
    z-index: 2;
    inset: 50px 44px 70px 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ru-customer-map-viewport.dragging {
    cursor: grabbing;
}

.ru-customer-map-grid.ru-gis-map-layer {
    position: relative;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 640 / 760;
    transform-origin: center;
    transition: transform .18s ease;
    pointer-events: auto;
}

.ru-customer-map-viewport.dragging .ru-customer-map-grid.ru-gis-map-layer {
    transition: none;
}

.ru-gis-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .86;
}

.ru-gis-outline,
.ru-gis-river,
.ru-gis-route {
    fill: rgba(6, 182, 212, .055);
    stroke: #22d3ee;
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, .55));
}

.ru-gis-river,
.ru-gis-route {
    fill: none;
    stroke-width: 2.4;
    opacity: .76;
}

.ru-gis-route {
    stroke: rgba(148, 163, 184, .36);
    stroke-width: 1.1;
    filter: none;
}

.ru-gis-route.faint {
    opacity: .45;
}

.ru-gis-node {
    fill: #67e8f9;
    filter: drop-shadow(0 0 8px rgba(103, 232, 249, .9));
    opacity: .82;
}

.ru-gis-point {
    position: absolute;
    z-index: 3;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #04111d;
    font-size: 9px;
    font-weight: 900;
    transform: translate(-50%, -50%) scale(var(--ru-map-marker-scale, 1));
    transform-origin: center;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .16), 0 0 18px currentColor;
}

.ru-gis-point.cool {
    background: #34d399;
    color: #34d399;
}

.ru-gis-point.warm {
    background: #fbbf24;
    color: #fbbf24;
}

.ru-gis-point.hot {
    background: #fb7185;
    color: #fb7185;
}

.ru-gis-point.muted {
    width: 7px !important;
    height: 7px !important;
    background: rgba(148, 163, 184, .55);
    color: rgba(148, 163, 184, .55);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, .16);
}

.ru-gis-point span {
    color: #061221;
    font-size: 0;
}

.ru-gis-point.active {
    outline: 2px solid #67e8f9;
    outline-offset: 5px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .35), 0 0 28px #67e8f9;
}

.ru-map-pan {
    position: absolute;
    z-index: 8;
    right: 18px;
    top: 84px;
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows: repeat(3, 30px);
    gap: 4px;
}

.ru-map-pan button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
}

.ru-map-pan .up {
    grid-column: 2;
    grid-row: 1;
}

.ru-map-pan .left {
    grid-column: 1;
    grid-row: 2;
}

.ru-map-pan .right {
    grid-column: 3;
    grid-row: 2;
}

.ru-map-pan .down {
    grid-column: 2;
    grid-row: 3;
}

.ru-gis-tooltip {
    position: absolute;
    z-index: 7;
    left: calc(100% + 14px);
    top: 50%;
    width: 270px;
    padding: 14px;
    border: 1px solid rgba(34, 211, 238, .42);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(15, 118, 145, .92), rgba(8, 47, 73, .9));
    box-shadow: 0 18px 45px rgba(0, 0, 0, .34), 0 0 24px rgba(34, 211, 238, .18);
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translateY(-50%) scale(.96);
    transform-origin: left center;
    transition: opacity .14s ease, transform .14s ease;
}

.ru-gis-point:hover .ru-gis-tooltip,
.ru-gis-point:focus-visible .ru-gis-tooltip {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.ru-gis-point.west-tooltip .ru-gis-tooltip {
    left: auto;
    right: calc(100% + 14px);
    transform-origin: right center;
}

.ru-map-detail-head span {
    color: rgba(215, 249, 255, .72);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.ru-map-detail-head h4 {
    margin: 6px 0 4px;
    font-size: 18px;
    color: #ecfeff;
}

.ru-map-detail-head p {
    margin: 0 0 12px;
    color: rgba(215, 249, 255, .78);
}

.ru-gis-tooltip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.ru-gis-tooltip-grid div {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
}

.ru-gis-tooltip-grid span,
.ru-gis-tooltip-grid strong {
    display: block;
}

.ru-gis-tooltip-grid span {
    color: rgba(215, 249, 255, .65);
    font-size: 10px;
}

.ru-gis-tooltip-grid strong {
    margin-top: 3px;
    color: #ecfeff;
}

.ru-gis-tooltip-communes {
    display: grid;
    gap: 5px;
}

.ru-gis-tooltip-communes span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(215, 249, 255, .78);
    font-size: 11px;
}

.ru-gis-tooltip-communes strong {
    color: #ecfeff;
}

.ru-gis-stats {
    position: absolute;
    z-index: 5;
    right: 18px;
    bottom: 78px;
    display: grid;
    grid-template-columns: repeat(3, minmax(82px, 1fr));
    gap: 8px;
    max-width: 360px;
}

.ru-gis-stats div {
    padding: 9px;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 7px;
    background: rgba(8, 27, 45, .72);
}

.ru-gis-stats span,
.ru-gis-stats strong {
    display: block;
}

.ru-gis-stats span {
    color: rgba(215, 249, 255, .58);
    font-size: 10px;
}

.ru-gis-stats strong {
    margin-top: 4px;
    color: #ecfeff;
}

.ru-gis-legend {
    position: absolute;
    z-index: 6;
    right: 18px;
    top: 188px;
    display: grid;
    grid-template-columns: auto auto;
    gap: 7px 9px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(34, 211, 238, .24);
    border-radius: 8px;
    background: rgba(8, 27, 45, .76);
    color: rgba(215, 249, 255, .76);
    font-size: 11px;
}

.ru-gis-legend span {
    grid-column: 1 / -1;
    color: #67e8f9;
    font-weight: 800;
}

.ru-gis-legend em {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.ru-gis-legend em.cool { background: #34d399; }
.ru-gis-legend em.warm { background: #fbbf24; }
.ru-gis-legend em.hot { background: #fb7185; }

.ru-gis-legend strong {
    font-size: 11px;
}

.ru-gis-timeline {
    position: absolute;
    z-index: 6;
    left: 18px;
    right: 18px;
    bottom: 18px;
    display: grid;
    grid-template-columns: auto repeat(5, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 8px;
    background: rgba(8, 27, 45, .8);
}

.ru-gis-timeline span,
.ru-gis-timeline strong {
    color: rgba(215, 249, 255, .72);
    font-size: 11px;
}

.ru-gis-timeline i {
    height: 4px;
    border-radius: 99px;
    background: rgba(34, 211, 238, .22);
}

.ru-gis-timeline i.active {
    background: #67e8f9;
    box-shadow: 0 0 14px rgba(34, 211, 238, .55);
}

.ru-roadmap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.ru-roadmap div {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--card-hover);
}

.ru-roadmap strong,
.ru-roadmap span,
.ru-roadmap em {
    display: block;
}

.ru-roadmap span {
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.4;
}

.ru-roadmap em {
    margin-top: 10px;
    color: var(--primary);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.ru-build-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.ru-checklist {
    display: grid;
    gap: 10px;
}

.ru-checklist>div {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: var(--text);
}

.ru-check-empty {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
}

.ru-aging-bars {
    display: grid;
    gap: 12px;
}

.ru-aging-bars>div {
    display: grid;
    grid-template-columns: 110px 140px minmax(120px, 1fr);
    gap: 12px;
    align-items: center;
}

.ru-aging-bars span {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 700;
}

.ru-aging-bars strong {
    font-size: 13px;
}

.ru-aging-bars em {
    height: 8px;
    border-radius: 999px;
    background: var(--input-bg);
    overflow: hidden;
}

.ru-aging-bars i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

.ru-list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px 10px;
    color: var(--text-dim);
    font-size: 12px;
}

.ru-list-controls label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.ru-per-page {
    width: 72px;
    min-height: 32px;
    padding: 5px 10px;
}

.ru-list-search {
    padding: 0 16px 12px;
}

.ru-list-search .form-control {
    width: 100%;
}

.ru-list-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 16px 12px;
    color: var(--text-dim);
    font-size: 13px;
}

.ru-pagination {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.ru-pagination-bottom:empty {
    display: none;
}

.ru-page-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
}

.ru-page-btn,
.ru-page-ellipsis {
    min-width: 36px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-right: 0;
    background: var(--card);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.ru-page-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.ru-page-btn:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 8px 8px 0;
}

.ru-page-btn.wide {
    min-width: 92px;
    padding: 0 12px;
}

.ru-page-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.ru-page-btn:disabled {
    cursor: not-allowed;
    opacity: .72;
}

.ru-page-btn:not(:disabled) {
    cursor: pointer;
}

.ru-page-btn:not(:disabled):hover {
    background: var(--card-hover);
}

.ru-page-btn.active:hover {
    background: var(--primary);
}

.ru-page-ellipsis {
    color: var(--text-dim);
}

.ru-sort-th button {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-align: left;
    text-transform: inherit;
    cursor: pointer;
}

.ru-sort-th.active {
    background: var(--primary-soft);
    color: var(--text);
}

.ru-link-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.ru-link-button:hover {
    text-decoration: underline;
}

.ru-clickable-row {
    cursor: pointer;
}

.ru-clickable-row:hover {
    background: var(--card-hover);
}

.ru-category-row {
    background: var(--input-bg);
}

.ru-subcategory-row td:first-child span {
    display: inline-flex;
    align-items: center;
    padding-left: 18px;
    color: var(--text-dim);
    font-weight: 700;
}

.ru-subcategory-row td:first-child span::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--secondary);
}

.ru-drilldown-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
}

.ru-drilldown-controls label {
    display: grid;
    gap: 6px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
}

.ru-drilldown-controls input {
    min-width: 160px;
}

.ru-drilldown-controls select {
    min-width: 190px;
}

.ru-purchase-line-chart {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    padding: 12px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.ru-purchase-line-chart svg {
    display: block;
    min-width: 620px;
    width: 100%;
    height: 220px;
}

.ru-line-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 2px 4px 10px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
}

.ru-line-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ru-line-legend i {
    width: 22px;
    height: 4px;
    border-radius: 999px;
    display: inline-block;
}

.ru-line-legend .purchase {
    background: var(--primary);
}

.ru-line-legend .document {
    background: var(--primary);
}

.ru-line-legend .sold {
    background: var(--secondary);
}

.ru-line-legend .paid {
    background: var(--secondary);
}

.ru-line-legend .commanded {
    background: var(--warning);
}

.ru-line-legend .credit {
    background: var(--danger);
}

.ru-line-legend .available {
    background: var(--text-dim);
}

.ru-line-axis {
    stroke: var(--border-strong);
    stroke-width: 1;
}

.ru-line-area {
    fill: var(--primary-soft);
    opacity: .85;
}

.ru-line-path {
    fill: none;
    stroke: var(--primary);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.ru-line-path-sold {
    stroke: var(--secondary);
}

.ru-line-path-paid {
    stroke: var(--secondary);
}

.ru-line-path-commanded {
    stroke: var(--warning);
}

.ru-line-path-credit {
    stroke: var(--danger);
}

.ru-line-path-available {
    stroke: var(--text-dim);
    stroke-dasharray: 7 7;
}

.ru-line-points circle {
    fill: var(--secondary);
    stroke: var(--modal-bg);
    stroke-width: 2;
}

.ru-line-points circle:not(.ru-line-point-sold) {
    fill: var(--primary);
}

.ru-line-points .ru-line-point-commanded {
    fill: var(--warning);
}

.ru-line-points .ru-line-point-paid {
    fill: var(--secondary);
}

.ru-line-points .ru-line-point-credit {
    fill: var(--danger);
}

.ru-line-points .ru-line-point-available {
    fill: var(--text-dim);
}

.ru-line-hit {
    fill: transparent;
    cursor: crosshair;
}

.ru-chart-tooltip {
    position: fixed;
    z-index: 3000;
    min-width: 150px;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--modal-bg);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease;
}

.ru-chart-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.ru-chart-tooltip strong,
.ru-chart-tooltip span {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.ru-chart-tooltip strong {
    margin-bottom: 6px;
}

.ru-chart-tooltip i {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}

.ru-chart-tooltip .document,
.ru-chart-tooltip .purchase {
    background: var(--primary);
}

.ru-chart-tooltip .paid,
.ru-chart-tooltip .sold {
    background: var(--secondary);
}

.ru-chart-tooltip .credit {
    background: var(--danger);
}

.ru-chart-tooltip .commanded {
    background: var(--warning);
}

.ru-chart-tooltip .available {
    background: var(--text-dim);
}

.ru-chart-tooltip .purchase {
    background: var(--primary);
}

.ru-chart-tooltip .sold {
    background: var(--secondary);
}

.ru-chart-tooltip .commanded {
    background: var(--warning);
}

.ru-chart-tooltip .available {
    background: var(--text-dim);
}

.ru-line-labels text,
.ru-line-y-label {
    fill: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
}

.ru-purchase-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 180px;
    padding: 18px 14px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    overflow-x: auto;
}

.ru-purchase-chart-item {
    min-width: 42px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
}

.ru-purchase-chart-bar {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(to top, var(--primary), var(--secondary));
}

.ru-purchase-chart-item span {
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.ru-drilldown-table {
    max-height: 420px;
    overflow: auto;
}

.ru-drilldown-list-search {
    margin: 10px 0 14px;
}

.ru-drilldown-list-search .form-control {
    width: 100%;
}

.ru-drilldown-list-bottom {
    margin-top: 14px;
}

@media (max-width: 1100px) {
    .ru-layout,
    .ru-report-head,
    .ru-hero,
    .ru-blueprint-banner,
    .ru-build-grid {
        grid-template-columns: 1fr;
    }

    .ru-aging-bars>div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .ru-list-controls,
    .ru-list-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .ru-page-buttons {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .ru-page-btn:first-child,
    .ru-page-btn:last-child {
        border-radius: 8px;
    }

    .ru-page-btn,
    .ru-page-ellipsis {
        border-right: 1px solid var(--border);
        margin-top: -1px;
    }

    .ru-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .ru-roadmap {
        grid-template-columns: 1fr;
    }

    .ru-report-tools {
        justify-items: start;
    }

    .ru-pagination {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .ru-gis-topbar,
    .ru-gis-body {
        grid-template-columns: 1fr;
    }

    .ru-map-actions {
        justify-content: flex-start;
    }

    .ru-gis-stage {
        min-height: 680px;
    }

    .ru-customer-map-viewport {
        inset: 70px 14px 145px 14px;
    }

    .ru-gis-tooltip {
        left: 50%;
        right: auto;
        top: auto;
        bottom: calc(100% + 12px);
        width: min(260px, calc(100vw - 42px));
        padding: 11px;
        transform: translate(-50%, 8px) scale(.96);
        transform-origin: bottom center;
    }

    .ru-gis-point.west-tooltip .ru-gis-tooltip {
        right: auto;
        transform-origin: bottom center;
    }

    .ru-gis-point:hover .ru-gis-tooltip,
    .ru-gis-point:focus-visible .ru-gis-tooltip {
        transform: translate(-50%, 0) scale(1);
    }

    .ru-gis-stats {
        left: 14px;
        right: 14px;
        bottom: 18px;
        grid-template-columns: repeat(2, 1fr);
        max-width: none;
    }

    .ru-gis-tooltip-grid {
        display: none;
    }

    .ru-gis-timeline,
    .ru-gis-legend {
        display: none;
    }
}

/* ── Settings ── */
.settings-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-tabs {
    position: sticky;
    top: 0;
    display: grid;
    gap: 6px;
}

.settings-tab {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    text-align: left;
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

html[dir="rtl"] .settings-tab {
    text-align: right;
}

.settings-tab:hover,
.settings-tab.active {
    background: var(--primary-soft);
    color: var(--text);
    border-color: var(--primary);
}

.settings-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    min-width: 0;
}

.settings-note {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.5;
}

.settings-logo-preview {
    height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-dim);
    font-size: 12px;
}

.settings-logo-preview img {
    max-width: 120px;
    max-height: 30px;
    object-fit: contain;
}

.settings-table input.form-control,
.settings-table select.form-control {
    min-width: 110px;
}

.settings-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    border: 1px solid rgba(245, 158, 11, .35);
    background: rgba(245, 158, 11, .08);
    border-radius: var(--radius-sm);
}

.settings-switch {
    position: relative;
    width: 58px;
    height: 32px;
    flex: 0 0 auto;
}

.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-switch span {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: var(--muted);
    border-radius: 999px;
    transition: .2s;
}

.settings-switch span:before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    left: 4px;
    top: 4px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

.settings-switch input:checked + span {
    background: var(--primary);
}

.settings-switch input:checked + span:before {
    transform: translateX(26px);
}

.delivery-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin-top: 12px;
    border: 1px solid var(--border);
    background: var(--soft-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.delivery-toggle-row .settings-switch {
    flex: 0 0 58px;
}

.settings-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.settings-permission-card {
    min-width: 0;
}

.settings-permission-list {
    display: grid;
    gap: 10px;
}

.settings-permission-module {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--soft-bg);
}

.settings-permission-module-title {
    font-weight: 800;
    text-transform: capitalize;
    margin-bottom: 8px;
}

.settings-permission-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-permission-checks label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--text-dim);
    background: var(--card);
    font-size: 12px;
    cursor: pointer;
}

.settings-permission-checks label:has(input:checked) {
    color: var(--text);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.settings-permission-checks label:has(input:disabled) {
    cursor: not-allowed;
    border-color: var(--border);
    background: var(--card);
}

.settings-permission-checks label small {
    font-size: 10px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-tabs {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-danger-zone {
        align-items: flex-start;
        flex-direction: column;
    }
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.totals-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 16px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.totals-row.grand {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-dim);
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

/* ══════════════════════════════════════
   POS — Vente au Comptoir
   ══════════════════════════════════════ */

.pos-shell {
    display: flex;
    gap: 0;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* ── Left: Product Browser ── */
.pos-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.pos-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

.pos-search-wrap {
    flex: 1;
    position: relative;
}

.pos-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

.pos-search {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px 9px 36px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.pos-search:focus {
    border-color: var(--primary);
}

.pos-tva-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: default;
    white-space: nowrap;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: 22px;
    transition: background 0.3s;
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(16px);
}

/* Products Grid */
.pos-products {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    align-content: start;
}

.pos-product-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.18s;
    user-select: none;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.pos-product-card:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-2px);
}

.pos-product-card.pos-out {
    opacity: 0.4;
    cursor: not-allowed;
}

.pos-prod-img {
    font-size: 34px;
    margin-bottom: 10px;
    height: 104px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-bg);
    overflow: hidden;
}

.pos-prod-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.pos-prod-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    min-height: 34px;
    margin-bottom: 7px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pos-prod-price {
    color: var(--primary);
    font-weight: 800;
    font-size: 14px;
    margin-top: auto;
    margin-bottom: 5px;
}

.pos-prod-stock {
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

.pos-prod-stock.low {
    color: var(--warning);
}

.pos-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

/* ── Right: Cart & Payment ── */
.pos-right {
    width: 360px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    overflow: hidden;
}

.pos-cart-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.pos-cart-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.pos-cart-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 20px;
}

.pos-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 4px;
    background: var(--card);
}

.pos-cart-prod {
    flex: 1;
    min-width: 0;
}

.pos-cart-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-cart-unit {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 2px;
}

.pos-cart-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pos-unit-price-input {
    width: 96px;
    height: 28px;
    padding: 3px 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.pos-unit-price-input:hover,
.pos-unit-price-input:focus {
    border-color: var(--primary);
    background: var(--input-bg);
    outline: none;
}

.pos-qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-strong);
    background: var(--card);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.pos-qty-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.pos-qty-val {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
}

.pos-cart-line {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.pos-remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.pos-remove-btn:hover {
    opacity: 1;
}

/* Customer Row */
.pos-customer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Totals */
.pos-totals {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.pos-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-dim);
}

.pos-discount-row input {
    margin: 0;
}

.pos-grand {
    font-size: 20px !important;
    font-weight: 800;
    color: var(--text) !important;
    border-top: 1px solid var(--border-strong);
    margin-top: 6px;
    padding-top: 10px !important;
}

/* Mini input */
.pos-mini-input {
    width: 80px;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text);
    font-size: 13px;
    text-align: center;
    outline: none;
}

/* Payment Section */
.pos-payment-section {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.pos-versement-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

/* Pay Button */
.pos-pay-btn {
    margin: 10px 12px 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}

.pos-pay-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
}

.pos-pay-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Vente en Ligne ── */
.vente-tabs {
    display: flex;
    gap: 4px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.vente-tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

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

/* ── POS View Toggle ── */
.pos-view-toggle {
    display: flex;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.pos-view-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.pos-view-btn:hover {
    background: var(--card);
    color: var(--text);
}

.pos-view-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ── POS Sale Mode Toggle ── */
.pos-mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--card);
    padding: 3px;
    flex-shrink: 0;
}

.pos-mode-btn {
    min-width: 68px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pos-mode-btn:hover {
    color: var(--text);
}

.pos-mode-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(79, 70, 229, .22);
}

/* ── POS List Row ── */
.pos-list-row {
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.pos-list-row:hover {
    background: var(--card-hover);
}

/* ── POS Products List container ── */
.pos-products-list {
    display: block !important;
    overflow-x: hidden;
}

/* ── Quick Add Customer Button ── */
.pos-add-cust-btn {
    width: 32px;
    height: 32px;
    border: 1px dashed var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-add-cust-btn:hover {
    background: var(--primary);
    color: #fff;
    border-style: solid;
}

/* ══════════════════════════════════════
   Vente en Ligne — Sales Page
   ══════════════════════════════════════ */

/* Stats Row */
.vel-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.vel-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.vel-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.vel-stat-val {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.vel-stat-lbl {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Table row */
.vel-row:hover {
    background: var(--card-hover);
}

/* Reference badge */
.vel-ref {
    font-weight: 700;
    color: var(--primary);
    font-family: monospace;
    font-size: 13px;
}

/* Detail header in view modal */
.vel-detail-header {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.vel-detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    font-size: 13px;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .kpi-grid,
    .vel-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid-3,
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    html,
    body {
        overflow: auto;
    }

    #app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    #sidebar {
        width: 100%;
        min-width: 0;
        position: sticky;
        top: 0;
        z-index: 20;
        max-height: 38vh;
        overflow: auto;
    }

    #main {
        min-height: calc(100vh - 60px);
    }

    .sidebar-logo {
        padding: 10px 14px;
    }

    #sidebar nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
        gap: 6px;
        padding: 8px;
    }

    #sidebar .nav-section,
    #sidebar .sidebar-footer {
        display: none !important;
    }

    #sidebar .nav-item {
        margin-bottom: 0;
        padding: 8px 10px;
    }

    #topbar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

    #content {
        padding: 16px;
    }

    .kpi-grid,
    .vel-stats,
    .form-grid-2,
    .form-grid-3,
    .wizard-steps,
    .product-summary,
    .product-media-grid,
    .grid-2,
    .grid-3,
    .vel-detail-info {
        grid-template-columns: 1fr;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .pos-shell {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .pos-right {
        width: 100%;
        min-width: 0;
    }

    .pos-left {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .pos-toolbar {
        flex-wrap: wrap;
    }

    .pos-search-wrap {
        min-width: 100%;
    }

    .table-wrap {
        margin-right: -4px;
    }

    table {
        min-width: 760px;
    }
}

@media (max-width: 560px) {
    .login-box-top {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 20px;
    }

    .login-box .theme-toggle-btn {
        width: 100%;
        justify-content: center;
    }

    .login-box {
        width: calc(100vw - 24px);
        padding: 28px 20px;
    }

    .card,
    .modal-body {
        padding: 16px;
    }

    .product-wizard {
        min-width: 0;
    }

    .wizard-step strong {
        white-space: normal;
    }

    .modal {
        min-width: 0;
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .modal-lg {
        min-width: 0;
    }

    .modal-xl {
        min-width: 0;
    }

    .sale-quick-add-row {
        grid-template-columns: 1fr 1fr;
    }

    .sale-quick-add-action {
        align-items: stretch;
    }

    .product-detail-view,
    .pos-product-detail {
        grid-template-columns: 1fr;
    }

    .product-detail-info h2,
    .pos-product-detail-info h2 {
        font-size: 22px;
    }

    .product-detail-price,
    .pos-detail-price {
        font-size: 23px;
    }

    .product-detail-grid,
    .product-detail-stock,
    .purchase-detail-meta,
    .product-tracking-kpis,
    .product-tracking-grid,
    .pos-detail-grid {
        grid-template-columns: 1fr;
    }

    .pos-products {
        grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
        gap: 10px;
    }

    .pos-product-card {
        min-height: 190px;
        padding: 10px;
    }

    .pos-prod-img {
        height: 88px;
    }

    .pos-prod-name {
        font-size: 12px;
    }

    .pos-prod-price,
    .pos-prod-stock {
        font-size: 12px;
    }

    .pos-cart-row {
        flex-wrap: wrap;
    }

    .pos-cart-line {
        width: 100%;
        align-items: flex-start;
    }

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

    .input-action .btn {
        width: auto;
    }

    .topbar-actions .btn,
    .sidebar-footer .logout-btn {
        width: auto;
    }
}

/* ── Invoice module ───────────────────────────────────── */
.invoice-detail-grid,
.invoice-preview-grid {
    display: grid;
    gap: 16px;
}

.invoice-sheet {
    width: min(190mm, 100%);
    max-width: 190mm;
    min-height: 270mm;
    margin: 0 auto;
    padding: 8mm;
    background: #fff;
    color: #111;
    border: 2px solid #b48a22;
    border-radius: 0;
    overflow: visible;
}

.invoice-a4-sheet {
    font-size: 10px;
    line-height: 1.25;
}

.invoice-a4-header {
    width: 100%;
    border-bottom: 1px solid #111;
    padding-bottom: 4px;
}

.invoice-a4-company {
    width: 68%;
    display: inline-block;
    vertical-align: top;
}

.invoice-a4-brand {
    width: 31%;
    display: inline-block;
    text-align: right;
    vertical-align: top;
}

.invoice-a4-brand img {
    max-width: 48mm;
    max-height: 18mm;
    object-fit: contain;
}

.invoice-a4-company-title {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.invoice-a4-company-line {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.invoice-a4-legal {
    font-size: 7px;
    margin-top: 2px;
}

.invoice-a4-logo-text {
    color: #0b2f6b;
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
}

.invoice-a4-logo-sub {
    color: #0b2f6b;
    font-size: 13px;
}

.invoice-a4-doc-row {
    margin-top: 8px;
    width: 100%;
}

.invoice-a4-left {
    width: 48%;
    display: inline-block;
    vertical-align: top;
}

.invoice-a4-right {
    width: 51%;
    display: inline-block;
    vertical-align: top;
}

.invoice-a4-title {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.invoice-a4-small {
    font-size: 8px;
}

.invoice-a4-items-wrap {
    overflow: visible;
}

.invoice-a4-items {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    table-layout: fixed;
}

.invoice-a4-items th {
    background: #eaf4f1;
    border: 1px solid #111;
    padding: 3px 4px;
    font-size: 8px;
    text-align: center;
    color: #111;
}

.invoice-a4-items td {
    border: 1px solid #111;
    padding: 3px 4px;
    font-size: 8px;
    vertical-align: top;
    color: #111;
    word-break: break-word;
}

.invoice-a4-after-table {
    margin-top: 7px;
    width: 100%;
}

.invoice-a4-summary-left {
    width: 66%;
    display: inline-block;
    vertical-align: top;
    padding-top: 24px;
}

.invoice-a4-totals {
    width: 31%;
    display: inline-block;
    vertical-align: top;
    border: 2px solid #111;
}

.invoice-a4-totals .row {
    border-bottom: 1px solid #111;
    padding: 5px 7px;
    clear: both;
    min-height: 20px;
}

.invoice-a4-totals .row:last-child {
    border-bottom: 0;
    font-weight: 900;
    background: #f7f7f7;
}

.invoice-a4-totals .label {
    float: left;
}

.invoice-a4-totals .value {
    float: right;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.invoice-brand {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.invoice-title {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 12px;
    color: var(--text-dim);
}

.invoice-number {
    font-size: 22px;
    font-weight: 800;
    margin: 6px 0 8px;
}

.invoice-meta-block {
    text-align: right;
}

.invoice-company-panel,
.invoice-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-legal-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-legal-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: var(--soft-bg);
}

.invoice-legal-lines {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.invoice-legal-lines div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.invoice-legal-lines span {
    color: var(--text-dim);
    flex: 0 0 auto;
}

.invoice-legal-lines strong {
    text-align: right;
    font-weight: 700;
}

.invoice-company-panel .label,
.invoice-notes .label {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .8px;
    font-size: 11px;
    margin-bottom: 6px;
}

.invoice-company-panel .value,
.invoice-notes .value {
    font-weight: 700;
    font-size: 15px;
}

.invoice-items-wrap {
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
}

.invoice-items-table th:nth-child(1),
.invoice-items-table td:nth-child(1) {
    width: 32%;
}

.invoice-items-table th:nth-child(2),
.invoice-items-table td:nth-child(2) {
    width: 8%;
}

.invoice-items-table th:nth-child(3),
.invoice-items-table td:nth-child(3),
.invoice-items-table th:nth-child(4),
.invoice-items-table td:nth-child(4) {
    width: 17%;
}

.invoice-items-table th:nth-child(5),
.invoice-items-table td:nth-child(5) {
    width: 8%;
}

.invoice-items-table th:nth-child(6),
.invoice-items-table td:nth-child(6) {
    width: 18%;
}

.invoice-items-table thead th {
    text-align: left;
    background: rgba(99, 102, 241, 0.12);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    font-size: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: normal;
    word-break: break-word;
}

.invoice-items-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 11px;
    white-space: normal;
    word-break: break-word;
}

.invoice-items-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-items-table .item-name {
    font-weight: 700;
}

.invoice-summary {
    align-items: start;
}

.invoice-notes {
    padding-right: 10px;
}

.invoice-footer-note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.6;
}

body.invoice-modal-printing #sidebar,
body.invoice-modal-printing #topbar,
body.invoice-modal-printing #content > :not(.modal-overlay.invoice-print-target),
body.invoice-modal-printing #toast-container {
    display: none !important;
}

body.invoice-modal-printing #app {
    display: block !important;
    height: auto !important;
}

body.invoice-modal-printing .modal-overlay {
    display: none !important;
}

body.invoice-modal-printing .modal-overlay.invoice-print-target {
    display: flex !important;
    position: fixed;
    inset: 0;
    background: #fff !important;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    overflow: visible;
}

body.invoice-modal-printing .modal-overlay.invoice-print-target .modal {
    width: 100%;
    max-width: 210mm;
    min-width: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

body.invoice-modal-printing .modal-overlay.invoice-print-target .modal-header,
body.invoice-modal-printing .modal-overlay.invoice-print-target .modal-footer,
body.invoice-modal-printing .modal-overlay.invoice-print-target .modal-close {
    display: none !important;
}

body.invoice-modal-printing .modal-overlay.invoice-print-target .modal-body {
    padding: 0;
}

@media print {
    body.invoice-modal-printing #sidebar,
    body.invoice-modal-printing #topbar,
    body.invoice-modal-printing #content > :not(.modal-overlay.invoice-print-target),
    body.invoice-modal-printing #toast-container {
        display: none !important;
    }

    body.invoice-modal-printing .modal-overlay {
        display: none !important;
    }

    body.invoice-modal-printing .modal-overlay.invoice-print-target {
        display: flex !important;
    }
}

.invoice-print-toolbar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 14px;
}

body.invoice-print-mode #sidebar,
body.invoice-print-mode #topbar,
body.invoice-print-mode #toast-container,
body.invoice-print-mode .modal-overlay {
    display: none !important;
}

body.invoice-print-mode #main {
    width: 100%;
}

body.invoice-print-mode #content {
    padding: 0;
    overflow: visible;
}

body.invoice-print-mode #app {
    display: block;
    height: auto;
}

body.invoice-print-mode .invoice-sheet {
    width: 190mm;
    max-width: 190mm;
    min-height: 270mm;
    margin: 0 auto;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        overflow: visible !important;
        background: #fff !important;
        color: #111 !important;
    }

    #sidebar,
    #topbar,
    #toast-container,
    .no-print,
    .modal-overlay {
        display: none !important;
    }

    #app,
    #main,
    #content {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .card {
        box-shadow: none !important;
        background: #fff !important;
        border-color: #dbe2ee !important;
    }

    .invoice-sheet {
        width: 190mm !important;
        max-width: 190mm !important;
        min-height: 270mm !important;
        padding: 8mm !important;
        margin: 0 auto !important;
        overflow: visible !important;
        page-break-inside: auto !important;
    }

    .invoice-items-wrap {
        overflow: visible !important;
    }

    .invoice-items-table {
        min-width: 0 !important;
        table-layout: fixed !important;
    }
}
