:root {
    --bg: #dfe4ea;
    --surface: #f9fafc;
    --surface-soft: #edf1f5;
    --surface-hover: #e4eaf1;
    --ink: #1c1e21;
    --muted: #65676b;
    --line: #cbd2dc;
    --primary: #1877f2;
    --primary-dark: #166fe5;
    --primary-soft: #e7f3ff;
    --success: #31a24c;
    --danger: #d93025;
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.70) inset, 0 4px 10px rgba(28, 30, 33, 0.08);
    --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 12px 26px rgba(28, 30, 33, 0.12);
    --shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.76) inset, 0 24px 58px rgba(28, 30, 33, 0.15);
    --shadow-pressed: inset 0 2px 6px rgba(28, 30, 33, 0.10), inset 0 -1px 0 rgba(255, 255, 255, 0.80);
    --input-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(28, 30, 33, 0.04), 0 2px 5px rgba(28, 30, 33, 0.05);
    --glow-primary: 0 0 0 4px rgba(24, 119, 242, 0.12), 0 12px 28px rgba(24, 119, 242, 0.16);
    --glow-soft: 0 12px 30px rgba(24, 119, 242, 0.10);
    --motion-fast: 0.16s ease;
    --motion: 0.22s ease;
    --radius: 12px;
    --radius-sm: 10px;
    --font: "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Deal Engine ------------------------------------------------------------- */
.deal-engine-page,
.deal-manage-page,
.deal-payment-ledger-page {
    display: grid;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.deal-product-picker {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.deal-product-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    align-items: end;
    gap: 12px;
}

.deal-product-picker-toolbar > strong {
    align-self: center;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    white-space: nowrap;
}

.deal-select-all {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    cursor: pointer;
}

.deal-select-all input,
.deal-product-option input,
.deal-option-card input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.deal-product-picker-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
    max-height: 330px;
    padding: 2px;
    overflow: auto;
}

.deal-product-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 9px !important;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: border-color var(--motion-fast), background var(--motion-fast);
}

.deal-product-option[hidden],
.deal-product-picker-empty[hidden],
[data-delivery-extra-field][hidden],
[data-delivery-extra-fields][hidden],
[data-cost-campaign][hidden],
[data-expense-campaign][hidden] {
    display: none !important;
}

.deal-product-option:hover,
.deal-product-option:has(input:checked) {
    border-color: rgba(24, 119, 242, 0.42);
    background: var(--primary-soft);
}

.deal-product-option > span {
    min-width: 0;
}

.deal-product-option strong,
.deal-product-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-product-option small,
.deal-chip small {
    color: var(--muted);
    font-size: 0.72rem;
}

.deal-product-picker-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

.deal-delivery-options {
    grid-column: 1 / -1;
}

.deal-delivery-options > span {
    display: block;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 700;
}

.deal-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 10px;
}

.deal-option-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px !important;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.deal-option-card:has(input:checked) {
    border-color: rgba(24, 119, 242, 0.48);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.08);
}

.deal-option-card strong,
.deal-option-card small {
    display: block;
}

.deal-option-card small {
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.5;
}

.deal-ledger-type {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.deal-ledger-expense {
    color: #8b2f2a;
    background: #fdecea;
}

.deal-ledger-payout {
    color: #176b31;
    background: #eaf8ee;
}

.deal-engine-hero,
.deal-manage-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 100% 0, rgba(24, 119, 242, 0.13), transparent 38%),
        linear-gradient(180deg, #fff, var(--surface));
}

[dir="rtl"] .deal-engine-hero,
[dir="rtl"] .deal-manage-hero {
    background:
        radial-gradient(circle at 0 0, rgba(24, 119, 242, 0.13), transparent 38%),
        linear-gradient(180deg, #fff, var(--surface));
}

.deal-engine-hero .section-heading,
.deal-manage-hero .section-heading {
    gap: 20px;
}

.deal-engine-hero .section-heading > div:first-child,
.deal-manage-hero .section-heading > div:first-child {
    max-width: 780px;
}

.deal-engine-hero h3,
.deal-manage-hero h3 {
    font-size: clamp(1.35rem, 2vw, 2rem);
    margin-bottom: 8px;
}

.deal-engine-hero .section-heading p:last-child,
.deal-manage-hero .section-heading p:last-child {
    margin: 0;
    color: var(--muted);
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.7;
}

.deal-engine-principles {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.deal-create-grid-simple {
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(180px, 1fr));
}

.deal-quick-setup {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(24, 119, 242, 0.22);
    box-shadow: 0 14px 40px rgba(24, 119, 242, 0.09);
}

.deal-quick-setup::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #62a3f8);
}

.deal-quick-step {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #fff, #f9fbff);
}

.deal-quick-step legend {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 8px;
    color: var(--text);
    font-weight: 800;
}

.deal-quick-step legend span {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.82rem;
}

.deal-quick-total,
.deal-quick-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.deal-quick-total {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(24, 119, 242, 0.08);
    color: var(--muted);
}

.deal-quick-total strong {
    color: var(--primary-strong);
    font-size: 1.15rem;
}

.deal-quick-submit {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    background: #eef6ff;
}

.deal-quick-submit p {
    margin: 4px 0 0;
    color: var(--muted);
}

.deal-quick-submit .btn-primary {
    flex: 0 0 auto;
}

.deal-engine-principles span,
.deal-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid rgba(24, 119, 242, 0.18);
    border-radius: 999px;
    color: #174f96;
    background: rgba(24, 119, 242, 0.07);
    font-size: 0.82rem;
    font-weight: 700;
}

.deal-create-grid,
.deal-filter-grid,
.deal-details-form .form-grid,
.deal-payment-form .form-grid {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.deal-filter-grid {
    align-items: end;
    margin-bottom: 18px;
}

.deal-filter-grid .btn-secondary {
    width: max-content;
    min-width: 120px;
}

.deal-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 14px;
}

.deal-card {
    display: grid;
    align-content: start;
    gap: 13px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, var(--surface-soft));
    box-shadow: var(--shadow-sm);
    transition: border-color var(--motion), transform var(--motion), box-shadow var(--motion);
}

.deal-card:hover {
    border-color: rgba(24, 119, 242, 0.28);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.deal-card-top,
.deal-card-money,
.deal-card-facts,
.deal-hero-actions,
.deal-status-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.deal-card-top {
    align-items: flex-start;
    justify-content: space-between;
}

.deal-card h3 {
    margin: 3px 0 0;
    font-size: 1.08rem;
}

.deal-card > p {
    margin: 0;
    min-height: 42px;
    color: var(--muted);
    line-height: 1.55;
}

.deal-code {
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.deal-card-facts {
    color: var(--muted);
    font-size: 0.82rem;
}

.deal-card-facts span {
    padding: 5px 8px;
    border-radius: 7px;
    background: #eef2f7;
}

.deal-card-facts strong {
    color: var(--ink);
}

.deal-card-money {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.deal-card-money > div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.deal-card-money span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.72rem;
}

.deal-card-money strong {
    font-size: 1rem;
}

.deal-card-alert {
    margin: 0;
    padding: 9px 10px;
    font-size: 0.78rem;
}

.deal-card-action {
    width: 100%;
    text-align: center;
}

.deal-empty-state {
    grid-column: 1 / -1;
    padding: 36px;
    border: 1px dashed #b9c5d2;
    border-radius: var(--radius);
    text-align: center;
    background: var(--surface-soft);
}

.deal-empty-state strong {
    font-size: 1.1rem;
}

.deal-empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.status-pill.deal-status-draft {
    color: #4d5968;
    border-color: #cfd6df;
    background: #f1f4f7;
}

.status-pill.deal-status-active {
    color: #176b31;
    border-color: #bfe4c9;
    background: #eaf8ee;
}

.status-pill.deal-status-paused {
    color: #8a4b00;
    border-color: #f0d3a5;
    background: #fff7e6;
}

.status-pill.deal-status-closed,
.status-pill.deal-status-cancelled {
    color: #6a3440;
    border-color: #e3c8ce;
    background: #faeef1;
}

.deal-hero-actions {
    justify-content: flex-end;
}

.deal-status-actions {
    padding-top: 13px;
    border-top: 1px solid var(--line);
}

.deal-section-nav {
    position: sticky;
    top: 8px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.deal-section-nav a {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 8px;
    color: #405168;
    font-size: 0.82rem;
    font-weight: 700;
}

.deal-section-nav a:hover {
    color: #fff;
    background: var(--primary);
}

.deal-details-summary {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    cursor: pointer;
    font-weight: 800;
    transition: background var(--motion-fast), border-color var(--motion-fast);
}

.deal-details-summary:hover {
    border-color: rgba(24, 119, 242, 0.3);
    background: var(--primary-soft);
}

details[open] > .deal-details-summary {
    margin-bottom: 14px;
}

.deal-details-form,
.deal-order-candidate-form {
    margin-bottom: 18px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}

.deal-cost-layout {
    margin-bottom: 18px;
    align-items: start;
}

.deal-cost-layout > div {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.deal-cost-layout h4 {
    margin: 0 0 13px;
}

.deal-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 13px 0;
}

.deal-chip form {
    display: inline-flex;
    margin: 0;
}

.deal-chip button {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #8b2732;
    background: rgba(217, 48, 37, 0.1);
    cursor: pointer;
}

.inline-reversal-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    gap: 6px;
    min-width: 240px;
}

.inline-reversal-form input {
    padding: 7px 9px;
}

.deal-row-reversed {
    opacity: 0.58;
    text-decoration: line-through;
}

.deal-waterfall {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 9px;
    margin-bottom: 18px;
}

.deal-waterfall > div {
    position: relative;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.deal-waterfall > div:not(:first-child)::before {
    content: "−";
    position: absolute;
    top: 50%;
    left: -8px;
    display: grid;
    width: 16px;
    height: 16px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #8794a6;
    transform: translateY(-50%);
    font-size: 0.75rem;
}

[dir="rtl"] .deal-waterfall > div:not(:first-child)::before {
    right: -8px;
    left: auto;
}

.deal-waterfall > .deal-waterfall-result::before {
    content: "=";
    background: var(--primary);
}

.deal-waterfall span {
    display: block;
    min-height: 34px;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 700;
}

.deal-waterfall strong {
    display: block;
    font-size: 1.02rem;
}

.deal-waterfall-minus strong {
    color: var(--danger);
}

.deal-waterfall-result {
    border-color: rgba(24, 119, 242, 0.28) !important;
    background: var(--primary-soft) !important;
}

.deal-waterfall-result strong {
    color: var(--primary-dark);
}

.deal-reconciliation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 9px;
}

.deal-reconciliation-ok {
    color: #176b31;
    border-color: #bfe4c9;
    background: #eaf8ee;
}

.deal-reconciliation-warning {
    color: #8a4b00;
    border-color: #f0d3a5;
    background: #fff7e6;
}

.deal-timeline {
    display: grid;
    gap: 0;
}

.deal-timeline article {
    position: relative;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 18px;
    padding: 10px 0 10px 18px;
    border-left: 2px solid #dbe5f1;
}

[dir="rtl"] .deal-timeline article {
    padding-right: 18px;
    padding-left: 0;
    border-right: 2px solid #dbe5f1;
    border-left: 0;
}

.deal-timeline article::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

[dir="rtl"] .deal-timeline article::before {
    right: -6px;
    left: auto;
}

.deal-timeline article > span,
.deal-timeline p {
    color: var(--muted);
    font-size: 0.78rem;
}

.deal-timeline strong,
.deal-timeline p {
    margin: 0;
}

@media (max-width: 1180px) {
    .deal-card-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
    }
    .deal-create-grid,
    .deal-details-form .form-grid,
    .deal-payment-form .form-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
    .deal-waterfall {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
    .deal-product-picker-list {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 760px) {
    .deal-card-grid,
    .deal-card-money,
    .deal-create-grid,
    .deal-filter-grid,
    .deal-details-form .form-grid,
    .deal-payment-form .form-grid,
    .deal-waterfall,
    .deal-cost-layout {
        grid-template-columns: 1fr;
    }
    .deal-product-picker-toolbar,
    .deal-product-picker-list,
    .deal-option-grid {
        grid-template-columns: 1fr;
    }
    .deal-engine-hero .section-heading,
    .deal-manage-hero .section-heading,
    .deal-reconciliation,
    .deal-quick-submit {
        align-items: stretch;
        flex-direction: column;
    }
    .deal-hero-actions {
        justify-content: flex-start;
    }
    .deal-timeline article {
        grid-template-columns: 1fr;
        gap: 3px;
    }
    .deal-waterfall > div::before {
        display: none !important;
    }
}

@media print {
    .deal-section-nav,
    .deal-quick-setup,
    .deal-status-actions,
    .deal-hero-actions,
    .deal-details-summary,
    .deal-details-form,
    .deal-payment-form,
    .deal-order-candidate-form,
    .deal-activity-panel,
    .inline-reversal-form,
    #deal-parties > details,
    #deal-products > details,
    #deal-fees > details,
    #deal-costs .two-column {
        display: none !important;
    }
    .deal-manage-page .panel {
        break-inside: avoid;
        box-shadow: none;
    }
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.58), transparent 24rem),
        radial-gradient(circle at top right, rgba(24, 119, 242, 0.08), transparent 34rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(203, 210, 220, 0.36)),
        var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.has-page-horizontal-scrollbar {
    padding-bottom: 18px;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    min-width: 100%;
}

html.sidebar-collapsed-pending .app-shell,
.app-shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
}

html.sidebar-collapsed-pending .sidebar,
.app-shell.sidebar-collapsed .sidebar {
    display: none;
}

.auth-shell {
    background:
        linear-gradient(180deg, rgba(24, 119, 242, 0.05), rgba(24, 119, 242, 0)),
        var(--bg);
}

.sidebar {
    min-height: 100vh;
    padding: 24px 16px;
    background: linear-gradient(180deg, #ffffff, var(--surface) 38%, var(--surface-soft));
    border-right: 1px solid var(--line);
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.78) inset, 14px 0 38px rgba(28, 30, 33, 0.09);
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
}

.sidebar-toggle {
    flex: 0 0 auto;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #c7d7ed;
    border-radius: 8px;
    background: #fff;
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font: inherit;
    transition: border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}

.sidebar-toggle-icon {
    display: grid;
    gap: 3px;
}

.sidebar-toggle-icon span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-toggle-text {
    font-size: 0.84rem;
    font-weight: 800;
    white-space: nowrap;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    border-color: rgba(24, 119, 242, 0.32);
    background: var(--primary-soft);
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

.brand-block {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius);
    transition: background var(--motion), transform var(--motion), box-shadow var(--motion);
}

.brand-block:hover {
    background: var(--surface-soft);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.brand-block h1,
.page-header h2,
.panel h3,
.login-card h1 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-block h1,
.login-card h1 {
    font-size: 1.65rem;
}

.page-header h2,
.panel h3 {
    font-size: 1.3rem;
}

.brand-block p,
.page-header p,
.login-card p,
.muted-note {
    margin: 4px 0 0;
    color: var(--muted);
}

.brand-logo,
.login-logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(180deg, #2d88ff, #1877f2);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    transition: transform var(--motion), box-shadow var(--motion);
}

.brand-block:hover .brand-logo,
.login-card:hover .login-logo {
    box-shadow: var(--glow-primary);
    transform: scale(1.04);
}

.brand-logo-image,
.login-logo.brand-logo-image {
    background: #dfe3ee;
}

.brand-logo img,
.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu {
    display: grid;
    gap: 10px;
}

.menu a {
    position: relative;
    overflow: hidden;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: #050505;
    font-weight: 600;
    transition: background var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.menu a::before {
    content: "";
    position: absolute;
    inset: 10px auto 10px 8px;
    width: 3px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0;
    transform: scaleY(0.45);
    transition: opacity var(--motion), transform var(--motion);
}

.menu a:hover {
    background: var(--surface-hover);
    box-shadow: var(--glow-soft);
    transform: translateX(2px);
}

.menu a.active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(24, 119, 242, 0.10), var(--glow-soft);
}

.menu a:hover::before,
.menu a.active::before {
    opacity: 1;
    transform: scaleY(1);
}

.menu-group {
    display: grid;
    gap: 6px;
    border-radius: var(--radius-sm);
}

.menu-group-title {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    user-select: none;
    transition: background var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.menu-group-title:hover {
    background: var(--surface-hover);
    color: var(--ink);
    box-shadow: var(--glow-soft);
}

.menu-group-title::-webkit-details-marker {
    display: none;
}

.menu-group-title::after {
    content: "+";
    font-size: 0.95rem;
    line-height: 1;
}

.menu-group[open] .menu-group-title {
    background: var(--surface-soft);
}

.menu-group[open] .menu-group-title::after {
    content: "-";
}

.menu-submenu {
    display: grid;
    gap: 4px;
    padding-top: 2px;
}

.menu-submenu a {
    margin-inline-start: 10px;
}

.language-switcher {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    display: grid;
    gap: 10px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.language-switcher:hover,
.user-chip:hover,
.sidebar-view-as-form:hover {
    border-color: rgba(24, 119, 242, 0.24);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.language-switcher span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.language-switcher-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.language-switcher-links a {
    padding: 8px 12px;
    border-radius: 999px;
    background: #e4e6eb;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.language-switcher-links a:hover {
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.language-switcher-links a.active {
    background: var(--primary);
    color: #fff;
}

.user-chip {
    margin-top: auto;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border: 1px solid var(--line);
    display: grid;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.user-chip strong {
    font-size: 0.96rem;
}

.user-chip span {
    color: var(--muted);
    font-size: 0.88rem;
}

.content {
    padding: 24px;
    width: 100%;
    min-width: 0;
    max-width: none;
    overflow-x: hidden;
    overflow-y: visible;
}

.content:has(.table-wrap) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.content:has(.product-table-wrap) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.content:has(.product-table-wrap) .panel {
    min-width: 0;
    max-width: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 20px;
    background: linear-gradient(180deg, #ffffff, var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.page-header::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
    opacity: 0.82;
}

.page-header:hover {
    border-color: rgba(24, 119, 242, 0.22);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.page-header > div {
    min-width: 0;
}

.page-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.page-header-main > div {
    min-width: 0;
}

.view-as-user-form {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 8px;
    align-items: end;
    min-width: 360px;
}

.view-as-user-form label {
    display: grid;
    gap: 6px;
    margin: 0;
    font-weight: 700;
}

.view-as-user-form label span {
    color: var(--muted);
    font-size: 0.78rem;
}

.view-as-user-form select {
    padding: 8px 10px;
}

.sidebar-view-as-form {
    grid-template-columns: 1fr;
    align-items: stretch;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.sidebar-view-as-form .small-btn {
    width: 100%;
}

.panel,
.stat-card,
.login-card {
    background: linear-gradient(180deg, #ffffff, var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.panel:hover,
.stat-card:hover,
.login-card:hover {
    border-color: rgba(24, 119, 242, 0.20);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.panel,
.login-card {
    padding: 20px;
    min-width: 0;
}

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

.stat-card {
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-soft), rgba(24, 119, 242, 0.08));
    opacity: 0.65;
    transform: scale(0.72);
    transition: transform var(--motion), opacity var(--motion);
}

.stat-card:hover::after {
    opacity: 1;
    transform: scale(1);
}

.stat-card span,
.eyebrow,
.section-heading p {
    display: inline-block;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 8px;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
    gap: 16px;
    min-width: 0;
}

.content:has(.api-keys-page) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: visible;
}

.content:has(.api-keys-page) > .page-header,
.content:has(.api-keys-page) > .alert,
.api-keys-page {
    width: min(100%, 1280px);
    max-width: 1280px;
}

.api-keys-page {
    display: grid;
    gap: 14px;
}

.api-keys-layout {
    align-items: start;
    grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
    gap: 14px;
}

.api-keys-layout .panel {
    align-self: start;
}

.api-keys-layout .info-card {
    margin-bottom: 10px;
    padding: 12px 14px;
}

.api-keys-layout .info-card:last-child {
    margin-bottom: 0;
}

.api-secret-copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    max-width: 880px;
}

.api-secret-copy-row input {
    flex: 1 1 520px;
    min-width: min(100%, 280px);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.api-secret-copy-row .small-btn {
    flex: 0 0 auto;
}

.api-copy-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: #e3f7e9;
    color: #1f7a3a;
    font-size: 0.8rem;
    font-weight: 800;
}

.api-prefix-cell code {
    display: inline-block;
    max-width: 100%;
}

.api-keys-page .api-keys-list-panel {
    width: 100%;
}

.api-keys-page .api-keys-table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.api-keys-page .api-keys-table-wrap > .api-keys-table {
    min-width: 1080px;
}

.api-key-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 230px;
}

.api-key-actions .inline-form {
    margin: 0;
}

.api-key-actions .small-btn {
    min-height: 32px;
    padding: 7px 10px;
    white-space: nowrap;
}

.api-permission-fieldset {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(203, 210, 220, 0.86);
    border-radius: var(--radius-sm);
    background: #fff;
}

.api-permission-fieldset legend {
    padding: 0 6px;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 900;
}

.api-permission-fieldset.is-muted {
    opacity: 0.72;
}

.api-permission-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.api-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}

.api-permission-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid rgba(203, 210, 220, 0.78);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
}

.api-permission-option input {
    width: 16px;
    min-width: 16px;
    height: 16px;
}

.api-permission-option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-resource-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 78px;
    overflow-y: auto;
}

.api-resource-list code {
    display: inline-flex;
    max-width: 100%;
    padding: 4px 7px;
    overflow: hidden;
    border: 1px solid #cfe0f5;
    border-radius: 6px;
    background: #eef5ff;
    color: #175cd3;
    font-size: 0.72rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-readonly-layout {
    display: block;
    min-width: 0;
}

.products-layout {
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: visible;
}

.products-layout > .panel:first-child {
    justify-self: start;
    width: min(1180px, calc(100vw - 48px));
    max-width: 1180px;
}

.products-layout > .panel:first-child .form-stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 280px));
    gap: 14px;
    align-items: end;
    justify-content: start;
}

.products-layout > .panel:first-child .form-stack label {
    min-width: 0;
    max-width: 280px;
}

.products-layout > .panel:first-child .form-stack label:has(textarea) {
    grid-column: span 2;
    max-width: 574px;
}

.products-layout > .panel:first-child .form-stack textarea {
    min-height: 44px;
    max-height: 110px;
    resize: vertical;
}

.products-layout > .panel:first-child .form-stack .product-image-preview,
.products-layout > .panel:first-child .form-stack .checkbox-row {
    align-self: end;
}

.products-layout > .panel:first-child .form-stack .product-image-fields {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    align-items: start;
    width: 100%;
}

.products-layout > .panel:first-child .form-stack .product-image-slot {
    display: grid;
    gap: 8px;
    align-content: start;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff, var(--surface-soft));
}

.products-layout > .panel:first-child .form-stack .product-image-slot label {
    max-width: none;
}

.products-layout > .panel:first-child .form-stack .product-image-slot input[type="file"] {
    min-height: 38px;
    padding: 7px 9px;
}

.products-layout > .panel:first-child .form-stack .product-image-slot .product-image-preview {
    align-self: start;
    width: 100%;
    max-width: none;
    height: 104px;
}

.products-layout > .panel:first-child .form-stack > .btn-primary {
    min-width: 220px;
    max-width: 260px;
}

.product-list-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.product-list-panel .section-heading,
.product-list-panel .product-table-tools {
    width: 100%;
}

.product-table-tools {
    display: grid;
    grid-template-columns: minmax(220px, 360px);
    gap: 10px;
    margin-bottom: 12px;
}

.products-table {
    table-layout: fixed;
}

.table-wrap > .products-admin-table {
    width: 1560px;
    min-width: 1560px;
}

.table-wrap > .products-readonly-table {
    width: max-content;
    min-width: 1080px;
}

.products-table th,
.products-table td {
    padding: 4px 6px;
    font-size: 0.76rem;
    line-height: 1;
    vertical-align: middle;
}

.products-table th {
    font-size: 0.68rem;
    letter-spacing: 0.035em;
}

.products-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-table .excel-filter-header {
    gap: 4px;
}

.products-table .excel-filter-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-table .product-thumb-grid {
    width: 76px;
    grid-template-columns: repeat(2, 36px);
    gap: 4px;
}

.products-table .product-thumb,
.products-table .product-thumb-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.products-table .excel-filter-button {
    width: 26px;
    height: 26px;
    border-radius: 7px;
}

.products-admin-table th:nth-child(1),
.products-admin-table td:nth-child(1) {
    width: 92px;
}

.products-admin-table th:nth-child(2),
.products-admin-table td:nth-child(2) {
    width: 82px;
}

.products-admin-table th:nth-child(3),
.products-admin-table td:nth-child(3) {
    width: 190px;
}

.products-admin-table th:nth-child(4),
.products-admin-table td:nth-child(4) {
    width: 74px;
}

.products-admin-table th:nth-child(5),
.products-admin-table td:nth-child(5) {
    width: 170px;
}

.products-admin-table th:nth-child(6),
.products-admin-table td:nth-child(6) {
    width: 82px;
}

.products-admin-table th:nth-child(7),
.products-admin-table td:nth-child(7) {
    width: 130px;
}

.products-admin-table th:nth-child(8),
.products-admin-table td:nth-child(8) {
    width: 80px;
}

.products-admin-table th:nth-child(9),
.products-admin-table td:nth-child(9) {
    width: 78px;
}

.products-admin-table th:nth-child(12),
.products-admin-table td:nth-child(12) {
    width: 78px;
}

.products-admin-table th:nth-child(10),
.products-admin-table td:nth-child(10) {
    width: 100px;
}

.products-admin-table th:nth-child(11),
.products-admin-table td:nth-child(11) {
    width: 104px;
}

.products-admin-table th:nth-child(13),
.products-admin-table td:nth-child(13) {
    width: 76px;
}

.products-admin-table th:nth-child(14),
.products-admin-table td:nth-child(14) {
    width: 76px;
}

.products-admin-table th:nth-child(15),
.products-admin-table td:nth-child(15) {
    width: 78px;
}

.products-admin-table th:nth-child(16),
.products-admin-table td:nth-child(16) {
    width: 150px;
}

.products-admin-table td:nth-child(16) {
    overflow: visible;
}

.products-readonly-table th:nth-child(1),
.products-readonly-table td:nth-child(1) {
    width: 320px;
}

.products-readonly-table th:nth-child(2),
.products-readonly-table td:nth-child(2) {
    width: 126px;
}

.products-readonly-table th:nth-child(3),
.products-readonly-table td:nth-child(3) {
    width: 140px;
}

.products-readonly-table th:nth-child(4),
.products-readonly-table td:nth-child(4) {
    width: 120px;
}

.products-readonly-table th:nth-child(5),
.products-readonly-table td:nth-child(5) {
    width: 92px;
}

.products-readonly-table th:nth-child(6),
.products-readonly-table td:nth-child(6) {
    width: 100px;
}

.products-readonly-table th:nth-child(7),
.products-readonly-table td:nth-child(7) {
    width: 120px;
}

.products-table td:nth-child(3) strong,
.products-readonly-table td:nth-child(1) strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-admin-table td:nth-child(3),
.products-readonly-table td:nth-child(1) {
    white-space: nowrap;
}

.products-admin-table .product-owner-stock-cell {
    line-height: 1.15;
    white-space: normal;
}

.products-admin-table .product-owner-stock-cell strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-admin-table .product-owner-stock-cell .table-subtext {
    margin-top: 2px;
    font-size: 0.7rem;
    line-height: 1.1;
    white-space: nowrap;
}

.stock-number-trigger {
    min-width: 42px;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid #c7d7ed;
    border-radius: 7px;
    background: #eef5ff;
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
}

.stock-number-trigger:hover,
.stock-number-trigger:focus-visible {
    border-color: rgba(24, 119, 242, 0.36);
    background: var(--primary-soft);
    box-shadow: var(--glow-primary);
    outline: none;
}

.products-admin-table .action-row {
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-width: max-content;
}

.products-admin-table .action-row form {
    flex: 0 0 auto;
}

.products-admin-table .action-row .small-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.72rem;
    line-height: 1;
    white-space: nowrap;
}

.product-owner-stock-editor {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    min-width: 0;
}

.product-owner-stock-editor .compact-heading {
    margin-bottom: 0;
}

.product-owner-stock-editor table {
    width: 100%;
    min-width: 1040px;
    table-layout: fixed;
}

.product-owner-stock-editor th:nth-child(1),
.product-owner-stock-editor td:nth-child(1) {
    width: 110px;
}

.product-owner-stock-editor th:nth-child(2),
.product-owner-stock-editor td:nth-child(2) {
    width: 210px;
}

.product-owner-stock-editor th:nth-child(3),
.product-owner-stock-editor td:nth-child(3) {
    width: 250px;
}

.product-owner-stock-editor th:nth-child(4),
.product-owner-stock-editor td:nth-child(4) {
    width: auto;
}

.product-owner-stock-editor th,
.product-owner-stock-editor td {
    vertical-align: top;
}

.product-owner-stock-editor td:nth-child(2) strong,
.product-owner-stock-editor td:nth-child(2) .table-subtext {
    overflow-wrap: anywhere;
}

.owner-partner-price-field {
    display: grid;
    gap: 5px;
    margin: 12px 0 0;
}

.owner-partner-price-field > span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.owner-partner-price-field input[type="number"] {
    min-height: 38px;
}

.owner-warehouse-country-cell {
    min-width: 0;
}

.product-owner-stock-editor input[type="number"] {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding-left: 10px;
    padding-right: 10px;
}

.owner-stock-warehouse-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #c7d7ed;
    border-radius: 999px;
    background: #e7f3ff;
    color: var(--primary-dark);
    font-size: 0.84rem;
    font-weight: 800;
    white-space: nowrap;
}

.owner-stock-by-warehouse-cell {
    min-width: 260px;
    overflow: visible;
    white-space: normal;
}

.owner-stock-warehouse-grid {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    min-width: 0;
}

.owner-stock-warehouse-collapse[open] > .owner-stock-warehouse-grid,
.owner-stock-warehouse-collapse[open] > .owner-country-pricing-grid,
.owner-stock-warehouse-collapse[open] > .owner-country-content {
    display: grid;
}

.owner-stock-warehouse-collapse {
    min-width: min(100%, 320px);
}

.owner-stock-warehouse-collapse > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--primary-dark);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    user-select: none;
}

.owner-stock-warehouse-collapse > summary::-webkit-details-marker {
    display: none;
}

.owner-stock-collapse-icon::before {
    content: "+";
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
}

.owner-stock-warehouse-collapse[open] .owner-stock-collapse-icon::before {
    content: "-";
}

.owner-stock-warehouse-collapse[open] > summary {
    margin-bottom: 10px;
    background: var(--primary-soft);
}

.owner-stock-warehouse-collapse[open] {
    min-width: 0;
}

.owner-fallback-collapse {
    width: 100%;
    min-width: 0;
}

.owner-fallback-collapse > summary {
    display: flex;
    width: 100%;
}

.owner-fallback-content {
    display: none;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}

.owner-fallback-collapse[open] > .owner-fallback-content {
    display: grid;
}

.owner-fallback-checkbox {
    margin: 0;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}

.owner-fallback-priority {
    display: grid;
    gap: 5px;
    min-width: 0;
    margin: 0;
}

.owner-fallback-content p {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.owner-country-pricing-cell { min-width: 260px; }
.owner-country-pricing-grid { display: none; gap: 10px; }
.owner-country-hierarchy {
    display: grid;
    gap: 10px;
}

.owner-country-section {
    width: 100%;
}

.owner-country-section > summary {
    display: flex;
    width: 100%;
}

.owner-country-section > summary small {
    margin-inline-start: auto;
    color: var(--muted);
    font-weight: 700;
}

.owner-country-content {
    display: none;
    gap: 12px;
}

.owner-country-warehouses {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}

.owner-country-content .owner-stock-warehouse-grid {
    display: grid;
}
.owner-country-pricing-row {
    display: grid;
    grid-template-columns: minmax(86px, 0.8fr) repeat(4, minmax(74px, 1fr));
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}

.owner-country-pricing-row > label {
    min-width: 0;
    margin: 0;
}

.owner-country-pricing-row > label > span {
    line-height: 1.2;
}

.owner-country-pricing-row input[type="number"] {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.owner-stock-warehouse-input {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.owner-stock-warehouse-input span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-owner-stock-editor .owner-stock-warehouse-input input[type="number"] {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 34px;
    padding: 6px 9px;
}

.stock-quantity-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.stock-quantity-preview strong {
    color: var(--text);
}

.stock-quantity-preview .stock-change-increase {
    color: #0b7a3d;
}

.stock-quantity-preview .stock-change-decrease {
    color: #c62828;
}

.stock-quantity-preview .stock-change-none {
    color: var(--muted);
}

.owner-stock-final-help {
    margin: 0;
}

@media (max-width: 1050px) {
    .owner-country-pricing-row {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .owner-country-pricing-row > .checkbox-row {
        grid-column: 1 / -1;
    }
}

@media (max-width: 680px) {
    .owner-country-pricing-row,
    .owner-stock-warehouse-grid {
        grid-template-columns: 1fr;
    }
}

.compact-checkbox {
    margin: 0;
    align-items: center;
}

.users-layout {
    grid-template-columns: 1fr;
}

.users-layout > .panel:first-child .form-stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}

.users-layout > .panel:first-child .form-stack label {
    min-width: 0;
}

.users-layout > .panel:first-child .form-stack > .btn-primary {
    min-width: 180px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.feature-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 12px;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.form-stack label {
    display: grid;
    gap: 7px;
    font-weight: 600;
    color: #1d2129;
    transition: color var(--motion-fast);
}

.form-stack label:focus-within {
    color: var(--primary);
}

.form-stack label span {
    font-size: 0.92rem;
}

.form-stack label:has(input[required], select[required], textarea[required]) > span:first-child::after,
.filter-grid label:has(input[required], select[required], textarea[required]) > span:first-child::after {
    content: " *";
    color: var(--danger);
    font-weight: 800;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #c4ccd7;
    background: #fff;
    color: var(--ink);
    box-shadow: var(--input-shadow);
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

input:hover,
select:hover,
textarea:hover {
    border-color: #aeb8c5;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98), 0 10px 22px rgba(28, 30, 33, 0.09);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select.open {
    z-index: 1300;
}

.searchable-select-source {
    display: none !important;
}

.searchable-select-input {
    padding-right: 38px;
}

.searchable-select.disabled .searchable-select-input,
.searchable-select.disabled .searchable-select-toggle {
    cursor: not-allowed;
    opacity: 0.72;
}

.searchable-select.disabled .searchable-select-input {
    background: #f3f4f6;
    color: #6b7280;
}

.searchable-select.disabled .searchable-select-list {
    display: none;
}

.locale-ar .searchable-select-input {
    padding-right: 14px;
    padding-left: 38px;
}

.searchable-select-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    padding: 0;
    touch-action: manipulation;
    transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}

.searchable-select-toggle:hover {
    background: var(--primary-soft);
    color: var(--primary);
    transform: translateY(-50%) scale(1.05);
}

.locale-ar .searchable-select-toggle {
    right: auto;
    left: 10px;
}

.searchable-select-toggle::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    margin: 9px auto 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
}

.searchable-select-list {
    position: absolute;
    z-index: 1301;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    display: none;
    max-height: 240px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
    outline: 1px solid rgba(255, 255, 255, 0.70);
}

.searchable-select.open .searchable-select-list {
    display: block;
}

.searchable-select-option,
.searchable-select-empty {
    padding: 10px 12px;
    font-size: 0.94rem;
}

.searchable-select-option {
    cursor: pointer;
    touch-action: manipulation;
    transition: background var(--motion-fast), color var(--motion-fast), padding var(--motion-fast);
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: #eef4ff;
    padding-inline-start: 16px;
}

.searchable-select-option.selected {
    font-weight: 700;
    color: var(--primary);
}

@media (hover: none), (pointer: coarse) {
    .searchable-select-input {
        min-height: 44px;
    }

    .searchable-select-toggle {
        width: 38px;
        height: 38px;
        right: 6px;
    }

    .locale-ar .searchable-select-toggle {
        right: auto;
        left: 6px;
    }

    .searchable-select-toggle::before {
        margin-top: 15px;
    }

    .searchable-select-list {
        max-height: min(320px, 52vh);
    }

    .searchable-select-option,
    .searchable-select-empty {
        min-height: 44px;
        padding: 12px 14px;
    }
}

.searchable-select-empty {
    color: var(--muted);
}

.searchable-multiple-search {
    margin-bottom: 8px;
}

.checkbox-row,
.checkbox-card {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.form-stack label.checkbox-row,
.form-stack label.checkbox-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-row input,
.checkbox-card input {
    width: auto;
    accent-color: var(--primary);
    margin: 0;
    flex: 0 0 auto;
}

.checkbox-row span,
.checkbox-card span {
    margin: 0;
}

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

.filter-grid,
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.phone-input-row {
    display: grid;
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
}

.order-location-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.order-page-name-row {
    display: grid;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.order-page-name-row.has-page-add {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
}

.order-page-add-btn {
    min-height: 44px;
    white-space: nowrap;
}

.order-products-block {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.order-product-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(92px, 130px) minmax(120px, 160px) auto;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.order-product-add {
    justify-self: start;
}

.form-stack .order-location-row label,
.form-stack .order-page-name-row label,
.form-stack .order-product-row label {
    min-width: 0;
}

.checkbox-card {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.checkbox-card:hover {
    border-color: rgba(24, 119, 242, 0.24);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.checkbox-card.locked {
    opacity: 0.7;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: background var(--motion), color var(--motion), transform var(--motion), box-shadow var(--motion);
}

.btn-danger {
    background: #fbe4e2;
    color: var(--danger);
}

.small-btn {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.86rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--glow-primary);
}

.btn-secondary {
    background: linear-gradient(180deg, #2d88ff, var(--primary));
    color: #fff;
}

.btn-secondary:hover {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: var(--glow-primary);
}

.btn-danger:hover {
    background: #f8d4d1;
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(217, 48, 37, 0.12), var(--shadow-md);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
    outline: 3px solid rgba(24, 119, 242, 0.28);
    outline-offset: 2px;
}

.btn-danger:focus-visible {
    outline-color: rgba(217, 48, 37, 0.26);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow-pressed);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
    cursor: not-allowed;
    opacity: 0.64;
    transform: none;
    box-shadow: none;
}

.btn-secondary:disabled:hover {
    background: linear-gradient(180deg, #2d88ff, var(--primary));
}

.btn-primary:disabled:hover,
.btn-danger:disabled:hover {
    transform: none;
    box-shadow: none;
}

.table-wrap {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #9aa4b2 #eef1f4;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    border: 1px solid rgba(203, 210, 220, 0.86);
    background: var(--surface-soft);
    box-shadow: var(--shadow-pressed);
}

.table-wrap > table {
    width: 100%;
    min-width: max-content;
}

.product-table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.product-table-wrap + .table-pagination {
    width: 100%;
    max-width: none;
}

.table-wrap::-webkit-scrollbar {
    height: 12px;
}

.table-wrap::-webkit-scrollbar-track {
    background: #eef1f4;
    border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: #9aa4b2;
    border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Stock tables stay readable while moving vertically and horizontally. */
.page-stock-management .table-wrap {
    max-height: min(72vh, 760px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
}

.page-stock-management .table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #eef5ff;
    box-shadow: 0 1px 0 rgba(145, 160, 181, 0.9), 0 4px 10px rgba(24, 39, 75, 0.08);
}

.page-stock-management .table-wrap .stock-sticky-product {
    position: sticky;
    inset-inline-start: 0;
    z-index: 3;
    min-width: 180px;
    max-width: 280px;
    background: #fff;
    box-shadow: 4px 0 10px -7px rgba(24, 39, 75, 0.65);
}

[dir="rtl"] .page-stock-management .table-wrap .stock-sticky-product {
    box-shadow: -4px 0 10px -7px rgba(24, 39, 75, 0.65);
}

.page-stock-management .table-wrap thead .stock-sticky-product {
    z-index: 6;
    background: #e4efff;
}

.page-stock-management .table-wrap tbody tr:nth-child(even) .stock-sticky-product {
    background: #f8fbff;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 10px 0 0;
    padding: 8px 10px;
    border: 1px solid rgba(203, 210, 220, 0.78);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #fff, #f8fafc);
    box-shadow: var(--shadow-pressed);
}

.table-pagination-hidden {
    display: none !important;
}

.table-pagination-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.table-pagination-size select {
    width: auto;
    min-width: 82px;
    min-height: 34px;
    padding: 6px 32px 6px 10px;
    font-size: 0.9rem;
}

.table-pagination-show-all {
    flex: 0 0 auto;
    min-width: 94px;
    white-space: nowrap;
}

.report-ad-spend-basis {
    display: grid;
    grid-column: span 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px 14px;
    min-width: 0;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.report-ad-spend-basis legend {
    padding: 0 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.report-ad-spend-basis label {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: 6px;
    margin: 0;
    min-width: 0;
    white-space: normal;
}

.report-ad-spend-basis input {
    flex: 0 0 auto;
    width: auto;
    min-height: 0;
    margin: 0;
}

@media (max-width: 700px) {
    .report-ad-spend-basis {
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
    }
}

.table-pagination-summary {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
}

.table-pagination-pages {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}

.table-pagination-page,
.table-pagination-ellipsis {
    min-width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 800;
}

.table-pagination-page {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
}

.table-pagination-page:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.table-pagination-page.is-active,
.table-pagination-page:disabled {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    cursor: default;
    box-shadow: var(--shadow-md);
    transform: none;
}

.table-pagination-ellipsis {
    color: var(--muted);
}

.table-pagination-navigation {
    width: auto;
    padding-inline: 11px;
}

.table-pagination-navigation:disabled {
    border-color: #d8dee8;
    background: #eef2f7;
    color: #8b95a5;
    box-shadow: none;
    opacity: 0.75;
}

.table-scrollbar {
    display: none !important;
    max-width: 100%;
    height: 18px;
    margin: 0 0 8px;
    overflow-x: scroll;
    overflow-y: hidden;
    position: sticky;
    top: 0;
    z-index: 8;
    border-radius: var(--radius-sm);
    background: var(--surface);
    scrollbar-color: #9aa4b2 #eef1f4;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    box-shadow: 0 8px 14px rgba(240, 242, 245, 0.88);
}

.table-scrollbar[hidden] {
    display: none;
}

.orders-table-scrollbar {
    background: var(--surface);
}

.table-scrollbar-inner {
    height: 1px;
}

.table-scrollbar::-webkit-scrollbar {
    height: 12px;
}

.table-scrollbar::-webkit-scrollbar-track {
    background: #eef1f4;
    border-radius: 999px;
}

.table-scrollbar::-webkit-scrollbar-thumb {
    background: #9aa4b2;
    border-radius: 999px;
}

.table-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.page-horizontal-scrollbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1200;
    height: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    direction: ltr;
    background: rgba(249, 250, 252, 0.96);
    border-top: 1px solid rgba(203, 210, 220, 0.92);
    box-shadow: 0 -6px 18px rgba(28, 30, 33, 0.10);
    scrollbar-color: #7f8da1 #eef1f4;
    scrollbar-width: thin;
}

.page-horizontal-scrollbar[hidden] {
    display: none;
}

.page-horizontal-scrollbar-inner {
    height: 1px;
}

.page-horizontal-scrollbar::-webkit-scrollbar {
    height: 14px;
}

.page-horizontal-scrollbar::-webkit-scrollbar-track {
    background: #eef1f4;
}

.page-horizontal-scrollbar::-webkit-scrollbar-thumb {
    background: #7f8da1;
    border-radius: 999px;
}

.page-horizontal-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #5f6b7a;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.82) inset;
}

tbody tr {
    transition: background var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
}

th,
td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

tbody tr:hover {
    background: #fafbfc;
    box-shadow: inset 4px 0 0 var(--primary), 0 8px 20px rgba(0, 0, 0, 0.04);
}

th {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(180deg, #f8fafc, #eef2f6);
    position: relative;
}

.excel-filter-th {
    position: relative;
}

.excel-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.excel-filter-title {
    min-width: 0;
}

.excel-filter-button {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    padding: 0;
    touch-action: manipulation;
    transition: border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
}

.excel-filter-button::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
}

.excel-filter-count {
    position: absolute;
    inset-block-start: -7px;
    inset-inline-end: -7px;
    min-width: 17px;
    height: 17px;
    display: inline-grid;
    place-items: center;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
}

.excel-filter-count[hidden] {
    display: none;
}

.excel-filter-button:hover,
.excel-filter-button.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.excel-filter-menu {
    position: fixed;
    z-index: 3000;
    display: grid;
    gap: 10px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.excel-filter-menu-title {
    color: var(--ink);
    font-weight: 800;
    font-size: 0.92rem;
}

.excel-filter-sort-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.excel-filter-sort-row button {
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    touch-action: manipulation;
    font-weight: 700;
    transition: border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
}

.excel-filter-sort-row button:hover {
    background: #eef4ff;
    border-color: #b8cdf8;
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.excel-filter-search {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
}

.excel-filter-select-all,
.excel-filter-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 0.9rem;
    touch-action: manipulation;
}

.excel-filter-select-all {
    grid-template-columns: auto minmax(0, 1fr);
    padding-bottom: 8px;
    border-bottom: 1px solid #edf0f2;
    font-weight: 800;
}

.excel-filter-values {
    display: grid;
    gap: 2px;
    max-height: 220px;
    overflow: auto;
    padding-right: 2px;
}

.excel-filter-option {
    padding: 6px 4px;
    border-radius: 6px;
    transition: background var(--motion-fast), padding var(--motion-fast);
}

.excel-filter-option:hover {
    background: #f7f8fa;
    padding-inline-start: 8px;
}

.excel-filter-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-filter-option small {
    color: var(--muted);
    font-size: 0.76rem;
}

.excel-filter-empty {
    padding: 10px 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.excel-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 2px;
}

@media (hover: none), (pointer: coarse) {
    .excel-filter-button,
    .products-table .excel-filter-button {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 8px;
    }

    .excel-filter-menu {
        gap: 12px;
        padding: 14px;
    }

    .excel-filter-sort-row button,
    .excel-filter-actions .small-btn {
        min-height: 42px;
    }

    .excel-filter-select-all,
    .excel-filter-option {
        min-height: 42px;
        padding: 8px 6px;
    }

    .excel-filter-option input,
    .excel-filter-select-all input {
        width: 18px;
        height: 18px;
    }
}

.table-subtext {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.85rem;
}

.product-image-preview {
    width: 96px;
    height: 96px;
    border: 1px solid #d8dde5;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff, var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.product-image-preview:hover,
.product-thumb:hover {
    border-color: rgba(24, 119, 242, 0.24);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.product-image-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.product-image-slot {
    display: grid;
    gap: 8px;
}

.product-image-fields .product-image-preview {
    width: 100%;
    max-width: 140px;
}

.product-image-preview img,
.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-thumb {
    width: 56px;
    height: 56px;
    border: 1px solid #d8dde5;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff, var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.product-thumb-button {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.product-thumb-button:focus-visible {
    outline: 3px solid rgba(24, 119, 242, 0.28);
    outline-offset: 2px;
}

.product-name-trigger {
    display: inline-flex;
    max-width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
}

.product-name-trigger strong {
    text-decoration: underline;
    text-decoration-color: rgba(24, 119, 242, 0.32);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.product-name-trigger:hover strong,
.product-name-trigger:focus-visible strong {
    color: var(--primary);
    text-decoration-color: currentColor;
}

.product-name-trigger:focus-visible {
    outline: 3px solid rgba(24, 119, 242, 0.24);
    outline-offset: 3px;
    border-radius: 6px;
}

.product-thumb-grid {
    display: grid;
    grid-template-columns: repeat(2, 56px);
    gap: 6px;
    align-items: start;
}

.product-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.75rem;
}

.status-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e7f3ff;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    transition: box-shadow var(--motion-fast), transform var(--motion-fast);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76), 0 3px 8px rgba(28, 30, 33, 0.06);
}

.status-pill:hover,
.order-status:hover,
.code-pill:hover {
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.code-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef1f4;
    color: #334155;
    font-size: 0.82rem;
    transition: box-shadow var(--motion-fast), transform var(--motion-fast);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 3px 8px rgba(28, 30, 33, 0.05);
}

.log-context {
    margin: 0;
    padding: 12px;
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 8px;
    background: #f7f8fa;
    color: var(--muted);
    font-size: 0.78rem;
    border: 1px solid #edf0f2;
}

.table-wrap textarea {
    min-width: 220px;
    resize: vertical;
}

.role-stack {
    display: grid;
    gap: 14px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
}

.location-management-grid {
    grid-template-columns: 1fr;
}

.inner-panel {
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    box-shadow: var(--shadow-pressed);
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.inner-panel:hover {
    box-shadow: var(--glow-soft);
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-row form {
    margin: 0;
}

.stock-block h4 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.stock-grid {
    display: grid;
    gap: 12px;
}

.stock-row-list {
    display: grid;
    gap: 10px;
}

.stock-entry-row {
    display: grid;
    grid-template-columns: minmax(96px, 140px) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.stock-entry-row label {
    min-width: 0;
}

.stock-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.stock-card:hover,
.stock-summary-card:hover,
.info-card:hover,
.role-card:hover {
    border-color: rgba(24, 119, 242, 0.20);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.stock-card span {
    display: block;
    margin-bottom: 10px;
    color: var(--ink);
    font-weight: 600;
}

.stock-summary-card {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.stock-summary-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.74rem;
    font-weight: 700;
}

.stock-summary-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.quantity-positive {
    color: var(--success);
    font-weight: 700;
}

.quantity-negative {
    color: var(--danger);
    font-weight: 700;
}

.analytics-stats .stat-card strong {
    font-size: 1.55rem;
}

.analytics-table-wrap {
    margin-bottom: 16px;
}

.analytics-table {
    min-width: 1120px;
}

.analytics-table th,
.analytics-table td {
    white-space: nowrap;
}

.order-management-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.order-management-table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.order-management-table {
    width: 1220px;
    min-width: 1220px;
    table-layout: fixed;
}

.table-wrap > .order-management-table[data-order-management-table] {
    width: 1220px;
    min-width: 1220px;
}

.order-management-table.order-management-table-has-actions,
.table-wrap > .order-management-table.order-management-table-has-actions[data-order-management-table] {
    width: 1340px;
    min-width: 1340px;
}

.order-management-table th,
.order-management-table td {
    padding: 5px 6px;
    overflow: hidden;
    font-size: 0.76rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.order-management-table th {
    font-size: 0.68rem;
    letter-spacing: 0.035em;
}

.order-management-table[data-order-management-table] th:nth-child(1),
.order-management-table[data-order-management-table] td:nth-child(1) {
    width: 34px;
}

.order-management-table[data-order-management-table] th:nth-child(2),
.order-management-table[data-order-management-table] td:nth-child(2) {
    width: 70px;
}

.order-management-table[data-order-management-table] th:nth-child(3),
.order-management-table[data-order-management-table] td:nth-child(3) {
    width: 150px;
}

.order-management-table[data-order-management-table] th:nth-child(4),
.order-management-table[data-order-management-table] td:nth-child(4) {
    width: 88px;
}

.order-management-table[data-order-management-table] th:nth-child(5),
.order-management-table[data-order-management-table] td:nth-child(5) {
    width: 150px;
}

.order-management-table[data-order-management-table] th:nth-child(6),
.order-management-table[data-order-management-table] td:nth-child(6) {
    width: 96px;
}

.order-management-table[data-order-management-table] th:nth-child(7),
.order-management-table[data-order-management-table] td:nth-child(7) {
    width: 160px;
}

.order-management-table[data-order-management-table] th:nth-child(8),
.order-management-table[data-order-management-table] td:nth-child(8) {
    width: 58px;
    text-align: center;
}

.order-management-table[data-order-management-table] th:nth-child(9),
.order-management-table[data-order-management-table] td:nth-child(9) {
    width: 82px;
}

.order-management-table[data-order-management-table] th:nth-child(10),
.order-management-table[data-order-management-table] td:nth-child(10) {
    width: 132px;
}

.order-management-table[data-order-management-table] th:nth-child(11),
.order-management-table[data-order-management-table] td:nth-child(11) {
    width: 78px;
}

.order-management-table[data-order-management-table] th:nth-child(12),
.order-management-table[data-order-management-table] td:nth-child(12) {
    width: 90px;
}

.order-management-table[data-order-management-table] .order-management-actions-cell {
    position: sticky;
    z-index: 2;
    inset-inline-end: 0;
    width: 120px;
    min-width: 120px;
    overflow: visible;
    background: #fff;
    text-align: center;
}

.order-management-table[data-order-management-table] thead .order-management-actions-cell {
    z-index: 4;
    background: #eef1f4;
}

.order-management-table[data-order-management-table] tbody tr:nth-child(even) .order-management-actions-cell {
    background: #f8fafc;
}

.order-management-table[data-order-management-table] tfoot .order-management-actions-cell {
    background: #eef1f4;
}

.order-management-table[data-order-management-table] th:nth-child(1),
.order-management-table[data-order-management-table] td:nth-child(1),
.order-management-table[data-order-management-table] th:nth-child(4),
.order-management-table[data-order-management-table] td:nth-child(4),
.order-management-table[data-order-management-table] th:nth-child(6),
.order-management-table[data-order-management-table] td:nth-child(6),
.order-management-table[data-order-management-table] th:nth-child(8),
.order-management-table[data-order-management-table] td:nth-child(8),
.order-management-table[data-order-management-table] th:nth-child(9),
.order-management-table[data-order-management-table] td:nth-child(9),
.order-management-table[data-order-management-table] th:nth-child(12),
.order-management-table[data-order-management-table] td:nth-child(12) {
    white-space: nowrap;
}

.order-management-table[data-order-management-table] td strong {
    font-size: 0.8rem;
    line-height: 1.05;
}

.order-management-table[data-order-management-table] .table-subtext {
    display: block;
    max-width: 100%;
    margin-top: 1px;
    overflow: hidden;
    color: #64748b;
    font-size: 0.64rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-management-table[data-order-management-table] td:nth-child(3) strong {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.order-management-table[data-order-management-table] .order-management-inline-muted {
    margin-inline-start: 6px;
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

.order-management-select-cell {
    width: 34px;
    min-width: 34px;
    text-align: center;
}

.order-management-select-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
}

.order-management-stack {
    display: grid;
    gap: 8px;
}

.order-management-stack .table-subtext {
    display: block;
}

.analytics-table tfoot th {
    background: #eef1f4;
    color: var(--ink);
    font-size: 0.86rem;
}

.analytics-actions {
    display: flex;
    justify-content: flex-end;
}

.order-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.orders-table {
    min-width: 1420px;
}

.orders-table th,
.orders-table td,
.orders-table .table-subtext {
    white-space: nowrap;
}

.orders-table td {
    vertical-align: middle;
}

.table-wrap > .orders-table[data-orders-table] {
    width: 1602px;
    min-width: 1602px;
    table-layout: fixed;
}

.table-wrap > .orders-table-no-actions[data-orders-table] {
    width: 1242px;
    min-width: 1242px;
}

.orders-table[data-orders-table] th,
.orders-table[data-orders-table] td {
    padding: 4px 6px;
    font-size: 0.76rem;
    line-height: 1;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.orders-table[data-orders-table] th {
    font-size: 0.68rem;
    letter-spacing: 0.035em;
}

.orders-table[data-orders-table] td > strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.orders-table[data-orders-table] .order-number-copy {
    display: block;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-table[data-orders-table] .order-number-copy:hover,
.orders-table[data-orders-table] .order-number-copy:focus-visible,
.orders-table[data-orders-table] .order-number-copy.is-copied {
    color: var(--primary);
    outline: none;
}

.orders-copy-bubble {
    position: absolute;
    z-index: 5000;
    padding: 6px 9px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.orders-copy-bubble.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.orders-table[data-orders-table] .table-subtext {
    display: block;
    max-width: 100%;
    margin-top: 1px;
    overflow: hidden;
    color: #64748b;
    font-size: 0.64rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-table[data-orders-table] .order-total-details {
    max-width: 120px;
}

.orders-table[data-orders-table] .order-phone-line {
    display: inline-flex;
    max-width: 100%;
    gap: 4px;
    vertical-align: middle;
}

.orders-table[data-orders-table] .orders-compact-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.orders-table[data-orders-table] .orders-compact-line > strong {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-product-items {
    display: grid;
    gap: 5px;
    min-width: 180px;
}

.order-product-items > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
}

.order-product-items span {
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.orders-table[data-orders-table] .orders-compact-muted {
    flex: 0 2 auto;
    min-width: 0;
    overflow: hidden;
    color: #64748b;
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-table[data-orders-table] .order-whatsapp-link,
.orders-table[data-orders-table] .order-whatsapp-link svg {
    width: 18px;
    height: 18px;
}

.orders-table[data-orders-table] .order-status {
    min-height: 22px;
    padding: 4px 7px;
    font-size: 0.68rem;
    line-height: 1;
}

.orders-table[data-orders-table] .table-filter-row td {
    padding: 4px 6px;
}

.orders-table[data-orders-table] .table-filter-row input,
.orders-table[data-orders-table] .table-filter-row select {
    min-height: 30px;
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 0.72rem;
}

.orders-table[data-orders-table] .filter-cell-stack {
    gap: 0;
}

.orders-table[data-orders-table] .filter-actions {
    gap: 4px;
    min-width: 118px;
    padding: 4px;
}

.orders-table[data-orders-table] .filter-actions .small-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.72rem;
}

.orders-table-has-actions th:nth-child(1),
.orders-table-has-actions td:nth-child(1) {
    width: 32px;
}

.orders-table-has-actions th:nth-child(2),
.orders-table-has-actions td:nth-child(2) {
    width: 150px;
}

.orders-table-has-actions th:nth-child(3),
.orders-table-has-actions td:nth-child(3) {
    width: 74px;
}

.orders-table-has-actions th:nth-child(4),
.orders-table-has-actions td:nth-child(4) {
    width: 252px;
}

.orders-table-has-actions th:nth-child(5),
.orders-table-has-actions td:nth-child(5) {
    width: 240px;
}

.orders-table-has-actions th:nth-child(6),
.orders-table-has-actions td:nth-child(6) {
    width: 74px;
}

.orders-table-has-actions th:nth-child(7),
.orders-table-has-actions td:nth-child(7) {
    width: 60px;
}

.orders-table-has-actions th:nth-child(8),
.orders-table-has-actions td:nth-child(8) {
    width: 96px;
}

.orders-table-has-actions th:nth-child(9),
.orders-table-has-actions td:nth-child(9) {
    width: 42px;
    text-align: center;
}

.orders-table-has-actions th:nth-child(10),
.orders-table-has-actions td:nth-child(10) {
    width: 126px;
}

.orders-table-has-actions th:nth-child(11),
.orders-table-has-actions td:nth-child(11) {
    width: 102px;
}

.orders-table-has-actions th:nth-child(12),
.orders-table-has-actions td:nth-child(12) {
    width: 116px;
    white-space: nowrap;
}

.orders-table-has-actions th:nth-child(13),
.orders-table-has-actions td:nth-child(13) {
    width: 224px;
    overflow: visible;
    white-space: nowrap;
}

.orders-table-no-actions th:nth-child(1),
.orders-table-no-actions td:nth-child(1) {
    width: 150px;
}

.orders-table-no-actions th:nth-child(2),
.orders-table-no-actions td:nth-child(2) {
    width: 74px;
}

.orders-table-no-actions th:nth-child(3),
.orders-table-no-actions td:nth-child(3) {
    width: 258px;
}

.orders-table-no-actions th:nth-child(4),
.orders-table-no-actions td:nth-child(4) {
    width: 240px;
}

.orders-table-no-actions th:nth-child(5),
.orders-table-no-actions td:nth-child(5) {
    width: 74px;
}

.orders-table-no-actions th:nth-child(6),
.orders-table-no-actions td:nth-child(6) {
    width: 60px;
}

.orders-table-no-actions th:nth-child(7),
.orders-table-no-actions td:nth-child(7) {
    width: 96px;
}

.orders-table-no-actions th:nth-child(8),
.orders-table-no-actions td:nth-child(8) {
    width: 42px;
    text-align: center;
}

.orders-table-no-actions th:nth-child(9),
.orders-table-no-actions td:nth-child(9) {
    width: 128px;
}

.orders-table-no-actions th:nth-child(10),
.orders-table-no-actions td:nth-child(10) {
    width: 104px;
}

.orders-table-no-actions th:nth-child(11),
.orders-table-no-actions td:nth-child(11) {
    width: 118px;
    white-space: nowrap;
}

.orders-page-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
}

.orders-page-size span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.orders-page-size select {
    min-width: 92px;
}

.orders-table-actions {
    margin-left: auto;
}

.orders-control-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.orders-export-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-inline-start: auto;
}

.orders-control-bar .orders-page-size {
    min-width: 112px;
}

.orders-control-bar .orders-page-size select {
    min-width: 76px;
}

.orders-bulk-delete-form {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.orders-bulk-delete-form select {
    width: auto;
    min-width: 150px;
}

.orders-bulk-delete-form input[name="bulk_cancel_reason"] {
    width: 170px;
}

.orders-advanced-filter-form {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.orders-advanced-filter-form select[multiple] {
    min-height: 104px;
    padding: 6px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 8px;
    background: linear-gradient(180deg, #2d88ff, var(--primary));
    color: #fff;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
    transition: background var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.pagination-link:hover {
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

.pagination-link.is-active {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.pagination-link.is-disabled {
    background: #e9eef5;
    color: #8b95a5;
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

.pagination-direction {
    min-width: 88px;
}

.pagination-ellipsis {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    min-height: 36px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 900;
}

.orders-create-layout > .panel:only-child {
    grid-column: 1 / -1;
}

.sales-store-assignment-list {
    display: grid;
    gap: 16px;
}

.sales-store-assignment-form {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.sales-store-assignment-form:first-child {
    padding-top: 0;
    border-top: 0;
}

.sales-store-assignment-form select[multiple] {
    min-height: 150px;
}

.request-delivery-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.request-delivery-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 8px;
    background: linear-gradient(180deg, #2d88ff, var(--primary));
    color: #fff;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
    transition: background var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.request-delivery-tabs a:hover {
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

.request-delivery-tabs a.active {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.transfer-stock-details {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.transfer-stock-details[hidden] {
    display: none;
}

.transfer-stock-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.transfer-stock-heading h4 {
    margin: 2px 0 0;
    font-size: 1rem;
}

.transfer-stock-total {
    display: grid;
    gap: 2px;
    text-align: right;
}

.transfer-stock-total span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.transfer-stock-total strong {
    font-size: 1.2rem;
}

.transfer-stock-table {
    min-width: 460px;
}

.transfer-stock-quantity {
    font-weight: 800;
}

.transfer-stock-quantity.is-positive {
    color: var(--success);
}

.transfer-quantity-error {
    color: var(--danger);
    font-size: 0.84rem;
    font-weight: 700;
}

.transfer-route-builder,
.transfer-route-list {
    display: grid;
    gap: 12px;
}

.transfer-route-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 220px) auto;
    gap: 10px;
    align-items: end;
}

.transfer-route-row.is-source {
    grid-template-columns: minmax(0, 1fr);
}

.form-stack .transfer-route-row label {
    min-width: 0;
}

.transfer-route-quantity-field input {
    width: 100%;
}

.transfer-route-add {
    justify-self: start;
}

.transfer-route-remove {
    white-space: nowrap;
}

.stock-transfer-list {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.compact-heading {
    margin-bottom: 12px;
}

.stock-transfer-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.order-management-selected-count {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #b8d8ff;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.order-management-bulk-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
}

.order-management-bulk-form label {
    display: grid;
    gap: 4px;
    min-width: 180px;
}

.order-management-bulk-form label[hidden] {
    display: none;
}

.order-management-bulk-form span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.order-management-bulk-form select,
.order-management-bulk-form input {
    min-height: 36px;
    padding: 8px 10px;
}

.stock-transfer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 180px;
}

.stock-transfer-actions button {
    white-space: nowrap;
}

.request-order-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.order-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    transition: box-shadow var(--motion-fast), transform var(--motion-fast);
}

.order-status-on-hold {
    background: #fff4d6;
    color: #8a5a00;
}

.order-status-delivered {
    background: #e3f7e9;
    color: #1f7a3a;
}

.order-status-received {
    background: #e3f7e9;
    color: #1f7a3a;
}

.order-status-in-transit {
    background: #fff0e0;
    color: #a05a00;
}

.order-status-processing {
    background: #e7f3ff;
    color: var(--primary);
}

.order-status-requested-for-delivery {
    background: #fff0e0;
    color: #a05a00;
}

.order-status-sent-to-delivery-company {
    background: #ecebff;
    color: #4b3db8;
}

.order-status-under-delivery {
    background: #e0f7f5;
    color: #0f766e;
}

.order-status-cancelled {
    background: #ffe5e2;
    color: var(--danger);
}

.order-status-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}

.order-status-form select,
.order-status-form input {
    padding: 8px 10px;
}

.order-inline-action-form {
    display: inline-flex;
    margin-top: 8px;
    margin-right: 6px;
}

.order-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    margin-top: 8px;
    margin-right: 6px;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: box-shadow var(--motion-fast), transform var(--motion-fast);
}

.order-icon-action:hover {
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.order-status-form .order-icon-action {
    margin-top: 0;
    margin-right: 0;
}

.orders-table[data-orders-table] .order-status-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    margin: 0;
    vertical-align: middle;
}

.orders-table[data-orders-table] .order-status-form select,
.orders-table[data-orders-table] .order-status-form input {
    min-height: 24px;
    padding: 3px 6px;
    font-size: 0.7rem;
}

.orders-table[data-orders-table] .order-status-form select {
    width: 92px;
    min-width: 92px;
}

.orders-table[data-orders-table] .order-status-form input:not([hidden]) {
    width: 68px;
    min-width: 68px;
}

.orders-table[data-orders-table] .order-inline-action-form {
    display: inline-flex;
    margin: 0 0 0 2px;
    vertical-align: middle;
}

.orders-table[data-orders-table] .order-icon-action {
    width: 24px;
    min-width: 24px;
    height: 24px;
    margin: 0 2px 0 0;
    font-size: 0.72rem;
}

.processing-orders-trigger {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.processing-orders-available-cell {
    background: linear-gradient(180deg, #e7f3ff, #d7ebff);
    box-shadow: inset 0 0 0 1px rgba(24, 119, 242, 0.22);
    animation: processing-orders-flash 1.6s ease-in-out infinite;
}

.processing-orders-available-cell .table-subtext {
    color: var(--primary-dark);
    font-weight: 800;
}

.processing-orders-available-cell .processing-orders-trigger {
    color: var(--primary-dark);
    font-weight: 800;
}

@keyframes processing-orders-flash {
    0%,
    100% {
        background-color: #e7f3ff;
        box-shadow: inset 0 0 0 1px rgba(24, 119, 242, 0.20), 0 0 0 rgba(24, 119, 242, 0);
    }

    50% {
        background-color: #cfe6ff;
        box-shadow: inset 0 0 0 1px rgba(24, 119, 242, 0.38), 0 0 0 4px rgba(24, 119, 242, 0.08);
    }
}

.processing-orders-trigger:hover,
.processing-orders-trigger:focus-visible {
    color: var(--primary-dark);
}

.processing-orders-dialog {
    width: min(1120px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    border: 0;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.processing-orders-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.processing-orders-dialog-inner {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 16px;
    max-height: calc(100vh - 32px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px;
    background: var(--surface);
}

.processing-orders-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.processing-orders-dialog-header h3 {
    margin-bottom: 4px;
}

.processing-orders-dialog-header p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.processing-orders-product-name {
    display: block;
    margin-top: 4px;
    color: var(--primary-dark);
    font-size: 1rem;
    line-height: 1.25;
}

.processing-orders-dialog-close {
    flex: 0 0 auto;
}

.product-image-dialog {
    width: min(980px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    border: 0;
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.30);
}

.product-image-dialog::backdrop {
    background: rgba(15, 23, 42, 0.72);
}

.product-image-dialog-inner {
    position: relative;
    display: grid;
    place-items: center;
    min-height: min(720px, calc(100vh - 32px));
    padding: 54px 78px 48px;
    background: #0f172a;
}

.product-image-dialog img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 150px);
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.26);
}

.product-image-dialog-close,
.product-image-dialog-nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.20);
}

.product-image-dialog-close {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    font-weight: 800;
}

.product-image-dialog-nav {
    top: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
    font-weight: 900;
    transform: translateY(-50%);
}

.product-image-dialog-prev {
    left: 18px;
}

.product-image-dialog-next {
    right: 18px;
}

.product-image-dialog-nav:disabled {
    cursor: default;
    opacity: 0.38;
}

.product-image-dialog-count {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 0.84rem;
    font-weight: 800;
}

.product-details-dialog {
    width: min(860px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    border: 0;
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.product-details-dialog::backdrop {
    background: rgba(15, 23, 42, 0.48);
}

.product-details-dialog-inner {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 16px;
    max-height: calc(100vh - 32px);
    padding: 20px;
    overflow: hidden;
    background: var(--surface);
}

.product-details-dialog-header,
.product-details-dialog-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.product-details-dialog-header h3 {
    margin-bottom: 4px;
}

.product-details-dialog-header p:last-child {
    margin: 0;
    color: var(--muted);
}

.product-details-table-wrap {
    max-height: min(460px, calc(100vh - 230px));
    overflow: auto;
}

.product-details-table {
    min-width: 720px;
}

.product-details-table th,
.product-details-table td {
    white-space: nowrap;
}

.product-details-dialog-actions {
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .product-image-dialog-inner {
        min-height: min(620px, calc(100vh - 32px));
        padding: 56px 52px 48px;
    }

    .product-image-dialog img {
        max-height: calc(100vh - 170px);
    }

    .product-image-dialog-nav {
        width: 40px;
        height: 40px;
    }

    .product-image-dialog-prev {
        left: 8px;
    }

    .product-image-dialog-next {
        right: 8px;
    }
}

.order-error-dialog {
    width: min(560px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.order-error-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.order-error-dialog-inner {
    display: grid;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
}

.order-error-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.order-error-dialog-header h3 {
    margin-bottom: 4px;
}

.order-error-dialog-header p:last-child {
    margin: 0;
    color: var(--muted);
}

.order-error-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 14px 18px;
    border: 1px solid #ffd4d1;
    border-radius: 8px;
    background: #ffefef;
    color: var(--danger);
    font-weight: 700;
}

.processing-orders-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.processing-orders-search {
    flex: 1 1 220px;
    min-width: 0;
}

.processing-orders-select-visible {
    flex: 0 0 auto;
}

.processing-orders-oldest-select {
    flex: 1 1 260px;
    min-width: 230px;
}

.processing-orders-bulk-form {
    flex: 1 1 390px;
    min-width: 320px;
}

.processing-orders-selection-meta {
    flex: 0 0 auto;
}

.processing-orders-search,
.processing-orders-oldest-select label {
    display: grid;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.processing-orders-search input,
.processing-orders-oldest-select input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
}

.processing-orders-select-visible {
    min-height: 38px;
    align-items: center;
    white-space: nowrap;
}

.processing-orders-oldest-select {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.processing-orders-bulk-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.processing-orders-bulk-form select,
.processing-orders-bulk-form input {
    min-height: 38px;
    padding: 8px 10px;
}

.processing-orders-selection-meta {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.processing-orders-transfer-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(100px, 0.55fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.processing-orders-transfer-form label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.processing-orders-transfer-form select,
.processing-orders-transfer-form input,
.processing-orders-transfer-destination {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
}

.processing-orders-transfer-destination {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.processing-orders-transfer-error {
    grid-column: 1 / -1;
    color: var(--danger);
    font-size: 0.84rem;
    font-weight: 700;
}

.processing-orders-table-wrap {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: min(62vh, 620px);
    overflow-x: auto;
    overflow-y: auto;
}

.processing-orders-table {
    min-width: 980px;
}

.processing-orders-table th,
.processing-orders-table td {
    white-space: nowrap;
}

.processing-orders-select-cell {
    width: 44px;
    min-width: 44px;
    text-align: center;
}

.processing-orders-select-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
}

.processing-orders-number-cell {
    text-align: center;
    font-weight: 700;
}

.processing-order-status-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 390px;
}

.processing-order-status-form select,
.processing-order-status-form input {
    padding: 8px 10px;
}

@media (max-width: 1100px) {
    .processing-orders-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .processing-orders-bulk-form {
        grid-column: 1 / -1;
    }

    .processing-orders-transfer-form {
        grid-template-columns: 1fr 1fr;
    }

    .processing-orders-selection-meta {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .processing-orders-toolbar,
    .processing-orders-oldest-select,
    .processing-orders-bulk-form,
    .processing-orders-transfer-form {
        grid-template-columns: 1fr;
    }
}

.order-phone-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.order-whatsapp-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #25d366;
    text-decoration: none;
}

.order-whatsapp-link svg {
    width: 28px;
    height: 28px;
    display: block;
}

.order-whatsapp-link:hover {
    color: #1fb457;
}

.order-customer-fields {
    position: relative;
    z-index: 20;
    display: grid;
    gap: 0;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form-stack .order-customer-field {
    position: relative;
    display: grid;
    gap: 7px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.form-stack .order-customer-field:focus-within {
    z-index: 25;
}

.form-stack .order-customer-field:last-child {
    border-bottom: 0;
}

.order-customer-field > span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.order-filter-form {
    gap: 12px;
}

.order-filter-table-wrap {
    border: 1px solid #bfc7d1;
    border-radius: 8px;
    background: #fff;
}

.order-filter-table {
    min-width: 1640px;
    border-collapse: separate;
    border-spacing: 0;
}

.order-filter-table th,
.order-filter-table td {
    min-width: 126px;
    padding: 0;
    border-right: 1px solid #d8dee6;
    border-bottom: 1px solid #d8dee6;
    vertical-align: middle;
}

.order-filter-table th {
    padding: 9px 10px;
    background: #eef3f8;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.order-filter-table th:last-child,
.order-filter-table td:last-child {
    border-right: 0;
}

.order-filter-table tbody tr:last-child td {
    border-bottom: 0;
}

.order-filter-table input,
.order-filter-table select {
    min-height: 38px;
    padding: 8px 10px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    font-size: 0.9rem;
}

.order-filter-table input:focus,
.order-filter-table select:focus {
    position: relative;
    z-index: 1;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.table-filter-row td {
    padding: 0;
    background: #fff;
    border-bottom-color: #cbd5e1;
}

.table-filter-row input,
.table-filter-row select {
    min-height: 36px;
    padding: 7px 9px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    font-size: 0.84rem;
}

.table-filter-row input:focus,
.table-filter-row select:focus {
    position: relative;
    z-index: 1;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.filter-cell-stack {
    display: grid;
    gap: 1px;
    background: #d8dee6;
}

.filter-actions {
    display: grid;
    gap: 6px;
    padding: 6px;
    min-width: 150px;
}

.filter-actions .small-btn {
    width: 100%;
}

.bulk-import-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.bulk-import-section .section-heading {
    flex-wrap: wrap;
    gap: 12px;
}

.bulk-import-section .section-heading .btn-secondary {
    white-space: nowrap;
}

.bulk-upload-control {
    max-width: 520px;
}

.bulk-import-form textarea {
    min-height: 180px;
    font-family: var(--font);
}

.bulk-default-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bulk-preview-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 18px 0 10px;
}

.bulk-preview-heading span,
.bulk-warning {
    color: #8a5a00;
}

.bulk-preview-table {
    min-width: 1360px;
}

.bulk-row-valid {
    background: #fbfffc;
}

.bulk-row-invalid {
    background: #fff8f7;
}

.bulk-import-errors {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.role-card {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    overflow: hidden;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.role-card summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #ffffff, var(--surface));
    transition: background var(--motion-fast), color var(--motion-fast);
}

.role-card summary:hover {
    background: var(--surface-hover);
}

.role-card summary::-webkit-details-marker {
    display: none;
}

.role-card summary span,
.role-card summary small {
    color: var(--muted);
}

.role-form {
    padding: 16px 18px 18px;
}

.brand-preview {
    min-height: 100%;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #eef4ff);
    border: 1px solid #dbe7ff;
}

.profile-item {
    padding: 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border: 1px solid var(--line);
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.profile-item:hover {
    border-color: rgba(24, 119, 242, 0.20);
    box-shadow: var(--glow-soft);
    transform: translateY(-1px);
}

.profile-item span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.74rem;
    font-weight: 700;
}

.info-card {
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.info-card strong {
    display: block;
    margin-bottom: 10px;
}

.simple-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 8px;
}

.template-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.locale-ar .simple-list {
    padding-left: 0;
    padding-right: 18px;
}

.alert {
    margin-bottom: 16px;
    padding: 13px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.alert-success {
    background: #edf7ed;
    color: #1e6b2c;
    border-color: #cce7d1;
}

.alert-error {
    background: #ffefef;
    color: var(--danger);
    border-color: #ffd4d1;
}

.alert-warning {
    background: #fff7e6;
    color: #8a4b00;
    border-color: #f3d09a;
}

.alert-info {
    background: #eef6ff;
    color: #0f4c9a;
    border-color: #cfe0fb;
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(320px, 420px);
    align-content: center;
    justify-content: center;
    gap: 48px;
    padding: 40px 20px;
}

.login-copy {
    align-self: center;
    max-width: 520px;
}

.login-copy h1 {
    margin: 0 0 12px;
    font-size: 3.4rem;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: var(--primary);
}

.login-copy p {
    margin: 0;
    color: #1c1e21;
    font-size: 1.6rem;
    line-height: 1.2;
}

.login-card {
    width: 100%;
    align-self: center;
}

.login-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.login-page .login-card {
    max-width: 400px;
}

.login-hint {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.login-flash {
    max-width: 420px;
    margin: 22px auto 0;
}

.system-error-page {
    min-height: 100vh;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 24px;
}

.system-error-panel {
    width: min(980px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 28px;
}

.system-error-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: #ffe5e2;
    color: var(--danger);
    font-weight: 900;
    margin-bottom: 16px;
}

.system-error-panel h1 {
    margin: 0 0 10px;
    font-size: 1.8rem;
}

.system-error-panel p {
    margin: 0 0 18px;
    color: var(--muted);
}

.system-error-meta {
    display: grid;
    gap: 4px;
    padding: 12px;
    margin: 18px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    overflow-wrap: anywhere;
}

.system-error-meta span {
    color: var(--muted);
    font-size: 0.9rem;
}

.system-error-trace {
    margin-top: 18px;
}

.system-error-trace summary {
    cursor: pointer;
    font-weight: 800;
    margin-bottom: 10px;
}

.system-error-trace pre {
    max-height: 420px;
    overflow: auto;
    padding: 14px;
    border-radius: 8px;
    background: #101827;
    color: #edf2ff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
}

.system-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

@media (max-width: 1180px) {
    .login-page {
        grid-template-columns: minmax(320px, 420px);
        gap: 24px;
    }

    .login-copy h1 {
        font-size: 2.8rem;
    }

    .login-copy p {
        margin-bottom: 24px;
        font-size: 1.2rem;
        color: var(--muted);
    }
}

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

.locale-ar .brand-block,
.locale-ar .login-hero,
.locale-ar .brand-preview {
    flex-direction: row-reverse;
}

.locale-ar .feature-list {
    padding-left: 0;
    padding-right: 18px;
}

.locale-ar .language-switcher-links {
    justify-content: flex-end;
}

.locale-ar .menu-submenu a {
    margin-inline-start: 0;
    margin-inline-end: 10px;
}

.locale-ar .menu a::before {
    inset: 10px 8px 10px auto;
}

.locale-ar .menu a:hover {
    transform: translateX(-2px);
}

.locale-ar .page-header::before {
    inset: 0 0 0 auto;
}

.locale-ar tbody tr:hover {
    box-shadow: inset -4px 0 0 var(--primary), 0 8px 20px rgba(0, 0, 0, 0.04);
}

.locale-ar th,
.locale-ar td {
    text-align: right;
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
        min-width: 0;
    }

    .sidebar {
        min-height: auto;
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-sm);
    }

    .menu {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        align-items: start;
    }

    .menu-group {
        min-width: 0;
    }

    .menu-submenu {
        display: grid;
        gap: 6px;
    }

    .stats-grid,
    .two-column,
    .inventory-grid,
    .permissions-grid,
    .filter-grid,
    .products-layout > .panel:first-child .form-stack,
    .users-layout > .panel:first-child .form-stack,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .products-layout > .panel:first-child .form-stack label:has(textarea) {
        grid-column: auto;
    }

    .products-layout > .panel:first-child {
        width: 100%;
        max-width: 100%;
    }

    .products-layout > .panel:first-child .form-stack label {
        max-width: none;
    }

    .content {
        padding: 18px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .language-switcher-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    html,
    body {
        overflow-x: hidden;
    }

    .app-shell {
        width: 100%;
    }

    .menu {
        grid-template-columns: 1fr;
    }

    .brand-block {
        padding: 6px 0;
    }

    .brand-logo,
    .login-logo {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .phone-input-row,
    .order-page-name-row.has-page-add,
    .order-location-row,
    .bulk-default-grid,
    .transfer-route-row,
    .order-product-row {
        grid-template-columns: 1fr;
    }

    .transfer-stock-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .transfer-stock-total {
        text-align: left;
    }

    .locale-ar .transfer-stock-total {
        text-align: right;
    }

    .order-page-add-btn {
        width: 100%;
    }

    .content,
    .panel,
    .login-card,
    .stat-card,
    .page-header {
        padding: 14px;
    }

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

    .page-header-main {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .section-heading,
    .transfer-stock-heading,
    .stock-transfer-export-actions,
    .filter-actions,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .action-row,
    .filter-actions,
    .stock-transfer-export-actions {
        display: flex;
    }

    .action-row > *,
    .action-row form,
    .filter-actions > *,
    .stock-transfer-export-actions > *,
    .order-management-bulk-form,
    .order-management-bulk-form label,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
    }

    .view-as-user-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .sidebar {
        padding: 14px;
        gap: 14px;
    }

    .brand-block,
    .brand-preview,
    .login-hero {
        align-items: flex-start;
    }

    .role-card summary {
        gap: 10px;
        align-items: flex-start;
        flex-direction: column;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .table-wrap textarea {
        min-width: 180px;
    }

    .table-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .table-pagination-size,
    .table-pagination-summary,
    .table-pagination-pages {
        width: 100%;
    }

    .table-pagination-size {
        justify-content: space-between;
    }

    .table-pagination-pages {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .product-table-tools {
        grid-template-columns: 1fr;
    }

    .product-owner-stock-editor table,
    .orders-table,
    .order-filter-table,
    .processing-orders-table,
    .transfer-stock-table {
        min-width: 720px;
    }

    .product-owner-stock-editor table {
        min-width: 980px;
    }

    .login-page {
        padding: 20px 14px;
    }

    .login-copy h1 {
        font-size: 2.2rem;
    }

    .login-copy p {
        font-size: 1rem;
    }

    .impersonation-banner {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .content,
    .panel,
    .login-card,
    .stat-card,
    .page-header,
    .sidebar {
        padding: 12px;
    }

    .language-switcher-links {
        grid-template-columns: 1fr;
    }

    .brand-block h1,
    .login-card h1 {
        font-size: 1.35rem;
    }

    .page-header h2,
    .panel h3 {
        font-size: 1.12rem;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card strong {
        font-size: 1.55rem;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .searchable-select-list {
        max-height: 240px;
    }
}

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

    .brand-block:hover,
    .menu a:hover,
    .menu-group-title:hover,
    .language-switcher:hover,
    .user-chip:hover,
    .sidebar-view-as-form:hover,
    .language-switcher-links a:hover,
    .page-header:hover,
    .panel:hover,
    .stat-card:hover,
    .login-card:hover,
    input:focus,
    select:focus,
    textarea:focus,
    .checkbox-card:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .product-image-preview:hover,
    .product-thumb:hover,
    .status-pill:hover,
    .order-status:hover,
    .code-pill:hover,
    .stock-card:hover,
    .stock-summary-card:hover,
    .info-card:hover,
    .role-card:hover,
    .profile-item:hover,
    .pagination-link:hover,
    .request-delivery-tabs a:hover,
    .order-icon-action:hover {
        transform: none;
    }
}

.api-docs-page {
    display: grid;
    gap: 18px;
    margin: 0 auto;
    max-width: 1180px;
    width: 100%;
}

.api-docs-hero {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 20px;
}

.api-docs-hero h1 {
    font-size: 1.7rem;
    line-height: 1.2;
    margin: 4px 0 6px;
}

.api-docs-hero p {
    color: var(--muted);
    margin: 0;
}

.api-docs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.api-docs-unlock {
    max-width: 620px;
}

.api-docs-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.system-updates-page {
    display: grid;
    gap: 16px;
    width: min(100%, 1040px);
    margin: 0 auto;
}

.system-updates-hero {
    overflow: hidden;
    position: relative;
}

.system-updates-hero::after {
    position: absolute;
    top: -54px;
    right: -42px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(24, 119, 242, 0.18), rgba(24, 119, 242, 0));
    content: "";
    pointer-events: none;
}

.system-updates-hero h3 {
    margin-bottom: 8px;
    font-size: 1.55rem;
}

.system-updates-hero p:last-child {
    margin: 0;
    color: var(--muted);
}

.system-updates-list {
    display: grid;
    gap: 14px;
    position: relative;
}

.system-update-entry {
    border-left: 4px solid var(--primary);
}

.locale-ar .system-update-entry {
    border-right: 4px solid var(--primary);
    border-left-width: 1px;
}

.system-update-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.system-update-entry-meta time,
.system-update-entry-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid rgba(24, 119, 242, 0.18);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.system-update-entry h3 {
    margin-bottom: 7px;
}

.system-update-entry > p {
    margin: 0 0 10px;
    color: var(--muted);
}

.system-update-entry ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-inline-start: 20px;
}

.api-docs-meta div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.api-docs-meta span {
    color: var(--muted);
    font-size: 0.9rem;
}

.api-docs-content {
    display: block;
    line-height: 1.6;
    max-width: 100%;
    overflow-x: auto;
}

.api-docs-content h1,
.api-docs-content h2,
.api-docs-content h3,
.api-docs-content h4 {
    color: var(--text);
    line-height: 1.25;
    margin: 22px 0 10px;
}

.api-docs-content h1:first-child {
    margin-top: 0;
}

.api-docs-content h1 {
    font-size: 1.65rem;
}

.api-docs-content h2 {
    border-top: 1px solid var(--border);
    font-size: 1.28rem;
    padding-top: 18px;
}

.api-docs-content h3 {
    font-size: 1.08rem;
}

.api-docs-content p {
    color: var(--muted);
    margin: 8px 0 12px;
}

.api-docs-content ul {
    margin: 8px 0 16px;
    padding-left: 22px;
}

.api-docs-content li {
    margin: 5px 0;
}

.api-docs-content pre {
    background: #0f172a;
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 10px 0 16px;
    overflow-x: auto;
    padding: 14px;
}

.api-docs-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.locale-ar .api-docs-content {
    direction: rtl;
    text-align: right;
}

.locale-ar .api-docs-content ul {
    padding-right: 22px;
    padding-left: 0;
}

.locale-ar .api-docs-content pre {
    direction: ltr;
    text-align: left;
}

.api-docs-content p code,
.api-docs-content li code {
    background: #eef5ff;
    border: 1px solid #cfe0f5;
    border-radius: 5px;
    color: #175cd3;
    padding: 1px 5px;
}

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

    .api-docs-content pre {
        font-size: 0.82rem;
    }
}

@media print {
    html,
    body {
        background: #fff !important;
        overflow: visible !important;
    }

    body.app-shell {
        display: block;
    }

    .sidebar,
    .page-header,
    .api-docs-actions {
        display: none !important;
    }

    .content {
        display: block;
        padding: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        overflow: visible !important;
    }

    .api-docs-page {
        display: block;
        max-width: none;
        width: 100%;
    }

    .api-docs-hero,
    .api-docs-content {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .api-docs-hero {
        margin-bottom: 16px;
    }

    .api-docs-content {
        overflow: visible;
    }

    .api-docs-content h2 {
        break-after: avoid;
        page-break-after: avoid;
    }

    .api-docs-content pre {
        background: #f4f6f8 !important;
        border: 1px solid #cbd2dc;
        color: #111 !important;
        white-space: pre-wrap;
        word-break: break-word;
    }
}
.delivery-order-field {
    position: relative;
    z-index: 50;
    display: grid;
    gap: 8px;
}

.delivery-order-field > label {
    margin: 0;
}

.delivery-order-autocomplete {
    position: relative;
    z-index: 50;
}

.delivery-order-autocomplete > input {
    position: relative;
    z-index: 2;
    width: 100%;
    pointer-events: auto;
}

.delivery-order-suggestions {
    position: absolute;
    z-index: 60;
    top: calc(100% + 4px);
    inset-inline: 0;
    max-height: 360px;
    overflow-y: auto;
    margin-top: 0;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.delivery-order-suggestion {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #0f172a;
    text-align: start;
    cursor: pointer;
}

.delivery-order-suggestion:hover,
.delivery-order-suggestion.is-active {
    background: #eaf3ff;
    color: #0b63ce;
}

.delivery-order-suggestion span,
.delivery-order-suggestion-empty {
    color: #64748b;
    font-size: 0.82rem;
}

.delivery-order-suggestion-empty {
    padding: 12px;
}

.page-delivery-collections .form-actions {
    align-items: end;
}

.page-delivery-collections .form-actions > .btn-primary,
.page-delivery-collections .form-actions > .btn-secondary,
.page-delivery-collections .form-actions > .btn-danger {
    min-width: 140px;
}

.page-delivery-collections .section-heading > .action-row {
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 720px) {
    .page-delivery-collections .form-actions > .btn-primary,
    .page-delivery-collections .form-actions > .btn-secondary,
    .page-delivery-collections .form-actions > .btn-danger {
        width: 100%;
    }

    .page-delivery-collections .section-heading > .action-row {
        width: 100%;
        justify-content: stretch;
    }

    .page-delivery-collections .section-heading > .action-row > .btn-primary,
    .page-delivery-collections .section-heading > .action-row > .btn-secondary,
    .page-delivery-collections .section-heading > .action-row > .btn-danger {
        flex: 1 1 auto;
    }
}
.reporting-hero .section-heading,
.report-export-actions,
.report-filter-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reporting-hero .section-heading {
    justify-content: space-between;
}

.report-filter-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.report-filter-panel {
    position: relative;
    z-index: 40;
    overflow: visible;
}

.report-filter-panel:hover {
    transform: none;
}

.reporting-stats {
    position: relative;
    z-index: 1;
}

.page-reporting .stat-card:hover {
    z-index: 1;
}

.report-filter-grid label {
    min-width: 0;
}

.report-filter-actions {
    align-self: end;
    grid-column: 1 / -1;
    justify-content: flex-end;
    width: 100%;
}

.report-filter-actions > button,
.report-filter-actions > .btn-primary,
.report-filter-actions > .btn-secondary {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
    min-width: 150px;
    margin: 0;
    white-space: nowrap;
}

.reporting-stats {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.report-stat-link {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.report-stat-link small {
    color: var(--primary);
    font-weight: 700;
}

.report-stat-card {
    overflow: visible;
    padding-top: 22px;
}

.report-stat-info {
    position: absolute;
    z-index: 6;
    inset-block-start: 10px;
    inset-inline-end: 10px;
}

.report-stat-info summary {
    position: relative;
    z-index: 2;
    display: grid;
    width: 25px;
    height: 25px;
    margin: 0;
    place-items: center;
    border: 1px solid #b9d3f5;
    border-radius: 50%;
    background: #edf5ff;
    color: #1264cf;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-weight: 800;
    list-style: none;
}

.report-stat-info summary::-webkit-details-marker {
    display: none;
}

.report-stat-info[open] {
    z-index: 20;
}

.report-stat-info[open] summary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.report-stat-info-popover {
    position: absolute;
    z-index: 1;
    inset-block-start: 32px;
    inset-inline-end: 0;
    width: min(310px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid #b9d3f5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 35, 64, 0.20);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 400;
    text-align: start;
}

.report-stat-info-popover b {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
}

.report-stat-info-popover p,
.report-stat-info-popover small {
    display: block;
    margin: 0;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.45;
    text-transform: none;
}

.report-stat-info-popover small {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

/* Shared information control for summary cards on every system page. */
.stat-card.has-card-info,
.metric-card.has-card-info,
.stock-summary-card.has-card-info {
    position: relative;
    overflow: visible;
}

.card-stat-info {
    position: absolute;
    z-index: 6;
    inset-block-start: 10px;
    inset-inline-end: 10px;
}

.card-stat-info summary {
    position: relative;
    z-index: 2;
    display: grid;
    width: 25px;
    height: 25px;
    margin: 0;
    place-items: center;
    border: 1px solid #b9d3f5;
    border-radius: 50%;
    background: #edf5ff;
    color: #1264cf;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    list-style: none;
}

.card-stat-info summary::-webkit-details-marker {
    display: none;
}

.card-stat-info[open] {
    z-index: 30;
}

.card-stat-info[open] summary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.card-stat-info-popover {
    position: absolute;
    z-index: 1;
    inset-block-start: 32px;
    inset-inline-end: 0;
    width: min(310px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid #b9d3f5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 35, 64, 0.20);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 400;
    text-align: start;
}

.card-stat-info-popover b,
.card-stat-info-popover p {
    display: block;
    margin: 0;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.45;
    text-transform: none;
}

.card-stat-info-popover b {
    margin-bottom: 6px;
    font-weight: 800;
}

/*
 * Information popovers are moved to <body> while open. A fixed, viewport-bound
 * layer prevents narrow cards, horizontal table scrollers and the page edge
 * from clipping the explanation.
 */
.card-info-floating-popover {
    position: fixed !important;
    z-index: 2147483000 !important;
    max-width: calc(100vw - 24px) !important;
    overflow: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
}

.metric-card.has-card-info,
.stock-summary-card.has-card-info {
    padding-inline-end: 44px;
}

.report-metric-link {
    color: var(--primary);
    text-decoration: none;
}

.report-metric-link:hover {
    text-decoration: underline;
}

/* Shared financial meaning: income/profit is green, cost/loss is red, zero is neutral. */
.financial-positive {
    color: #14823b !important;
    font-weight: 800;
}

.financial-negative,
.financial-cost {
    color: #c62828 !important;
    font-weight: 800;
}

.financial-neutral {
    color: inherit;
}

.stat-card.financial-positive {
    border-color: rgba(20, 130, 59, 0.32);
    background: linear-gradient(145deg, var(--surface) 68%, rgba(20, 130, 59, 0.08));
    color: inherit !important;
}

.stat-card.financial-negative,
.stat-card.financial-cost {
    border-color: rgba(198, 40, 40, 0.30);
    background: linear-gradient(145deg, var(--surface) 68%, rgba(198, 40, 40, 0.07));
    color: inherit !important;
}

.financial-income-input input,
input.financial-positive {
    color: #14823b !important;
    border-color: rgba(20, 130, 59, 0.38);
    font-weight: 800;
}

.financial-cost-input input,
input.financial-negative,
input.financial-cost {
    color: #c62828 !important;
    border-color: rgba(198, 40, 40, 0.34);
    font-weight: 800;
}

.product-decision-table-wrap {
    max-height: 72vh;
    overflow: auto;
}

.page-product-decision .report-export-actions form {
    margin: 0;
}

.page-product-decision .report-export-actions button,
.page-product-decision .report-export-actions .btn-secondary {
    min-height: 42px;
}

.product-decision-table-wrap table {
    min-width: 1250px;
}

.product-decision-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--surface-soft);
}

.product-decision-table-wrap th:first-child,
.product-decision-table-wrap td:first-child {
    position: sticky;
    inset-inline-start: 0;
    z-index: 2;
    min-width: 220px;
    background: var(--surface);
}

.product-decision-table-wrap thead th:first-child {
    top: 0;
    z-index: 5;
}

.decision-sort-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: inherit;
    cursor: pointer;
}

.decision-sort-indicator {
    display: inline-grid;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid #c8d5e5;
    border-radius: 6px;
    background: #fff;
    color: var(--primary-dark);
}

.decision-sort-button:hover .decision-sort-indicator,
.decision-sort-button:focus-visible .decision-sort-indicator {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.decision-money-input {
    align-items: center;
    display: flex;
    gap: 6px;
    min-width: 135px;
}

.decision-money-input span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.decision-percent-input {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 92px;
}

.decision-percent-input span {
    color: var(--muted);
    font-weight: 800;
}

.decision-global-delivery {
    display: flex;
    align-items: end;
    gap: 16px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #b9d5f7;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
}

.decision-global-delivery label {
    display: grid;
    gap: 6px;
    min-width: 260px;
    margin: 0;
    font-weight: 800;
}

.decision-global-delivery p {
    margin: 0 0 8px;
    color: var(--muted);
}

@media (max-width: 700px) {
    .decision-global-delivery {
        align-items: stretch;
        flex-direction: column;
    }
}

.decision-simulator-input {
    min-width: 0;
    padding: 8px 9px;
    width: 92px;
}

.decision-simulator-input.compact-number {
    width: 72px;
}

.decision-simulator-input:focus {
    background: #fffbea;
}

.manual-spend-label {
    display: block;
    margin-top: 4px;
}

.decision-spend-dialog {
    width: min(92vw, 560px);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
}

.decision-spend-dialog::backdrop {
    background: rgba(15, 23, 42, 0.46);
}

.decision-spend-dialog-card {
    display: grid;
    gap: 14px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.decision-spend-dialog-card h3,
.decision-spend-dialog-card p {
    margin: 0;
}

.settlement-rule-grid {
    align-items: end;
}

.settlement-rule-grid .metric-card {
    min-height: 76px;
}

.settlement-rule-grid .metric-card strong {
    font-size: 22px;
}

.report-table-wrap table {
    min-width: 1250px;
}

.report-table-wrap th:first-child,
.report-table-wrap td:first-child {
    left: 0;
    position: sticky;
    z-index: 2;
}

.report-table-wrap th:first-child {
    z-index: 3;
}

@media (max-width: 700px) {
    .report-filter-grid {
        grid-template-columns: 1fr;
    }

    .report-export-actions,
    .report-export-actions a,
    .report-filter-actions,
    .report-filter-actions a,
    .report-filter-actions button {
        width: 100%;
    }

    .report-filter-actions {
        justify-content: stretch;
    }
}
.meta-connection-status {
    align-items: center;
    background: var(--surface-soft, #f6f8fb);
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 18px 0 12px;
    padding: 12px 14px;
}

.meta-account-selection {
    border-top: 1px solid var(--border);
    margin-top: 18px;
    padding-top: 18px;
}

.campaign-connection-collapse {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.campaign-connection-collapse > summary {
    align-items: center;
    background: var(--surface-soft, #f6f8fb);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    font-weight: 800;
    gap: 6px 16px;
    justify-content: space-between;
    list-style: none;
    padding: 14px 16px;
}

.campaign-connection-collapse > summary::-webkit-details-marker {
    display: none;
}

.campaign-connection-collapse > summary::after {
    content: "+";
    font-size: 20px;
    line-height: 1;
}

.campaign-connection-collapse[open] > summary::after {
    content: "−";
}

.campaign-connection-collapse > summary small {
    color: var(--muted);
    font-weight: 600;
    margin-inline-start: auto;
}

.campaign-connection-collapse-body {
    padding: 18px 16px;
}

.meta-sync-actions {
    display: grid;
    gap: 14px;
}

.meta-spend-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.meta-load-campaigns-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(300px, 1.5fr) minmax(170px, .7fr) minmax(170px, .7fr) auto;
}

.meta-account-load-field {
    display: grid;
    gap: 7px;
    min-width: 0;
    font-weight: 600;
}

.meta-account-load-field > span {
    font-size: .92rem;
}

.meta-account-load-dropdown .report-multi-filter-menu {
    min-width: min(620px, calc(100vw - 56px));
}

.meta-account-load-dropdown .meta-account-select-all {
    position: sticky;
    top: 46px;
    z-index: 1;
    border-bottom: 1px solid var(--line);
    background: var(--primary-soft);
    font-weight: 900;
}

.meta-account-load-dropdown .meta-account-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.campaign-assignment-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.campaign-assignment-actions form {
    margin: 0;
}

@media (max-width: 700px) {
    .meta-spend-form {
        grid-template-columns: 1fr;
    }

    .meta-load-campaigns-form {
        grid-template-columns: 1fr;
    }

    .meta-spend-form button,
    .meta-load-campaigns-form button {
        width: 100%;
    }
}

.campaign-link-table table {
    min-width: 1050px;
}

.campaign-link-table select {
    min-width: 280px;
}

.campaign-product-form {
    align-items: center;
    display: flex;
    gap: 10px;
}
.user-country-fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin: 0;
    padding: 14px;
}

.user-country-fieldset legend {
    font-weight: 800;
    padding: 0 6px;
}
.order-management-country-filter {
    min-width: 210px;
}

.order-management-country-filter label {
    margin: 0;
}
.country-context-switcher {
    background: var(--surface-soft, #f6f8fb);
    border: 1px solid var(--border, #dfe5ec);
    border-radius: 12px;
    margin: 0 0 14px;
    padding: 12px;
}

.country-context-switcher label,
.country-context-switcher select {
    width: 100%;
}
.dashboard-country-context {
    align-items: center;
    background: linear-gradient(135deg, #eaf3ff, #f7fbff);
    border-color: #9fc6f5;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.dashboard-country-context div {
    align-items: baseline;
    display: flex;
    gap: 10px;
}

.dashboard-country-context strong {
    color: #0969da;
    font-size: 1.35rem;
}

.dashboard-country-context p {
    margin: 0;
}

@media (max-width: 700px) {
    .dashboard-country-context {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}
.delivery-bonus-grid {
    align-items: end;
    background: var(--surface-soft, #f6f8fb);
    border: 1px solid var(--border, #dfe5ec);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 8px;
    padding: 14px;
}
.report-multi-filter-label {
    min-width: 0;
}

.report-multi-filter {
    position: relative;
}

.report-multi-filter > summary {
    min-height: 42px;
    padding: 10px 38px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-multi-filter > summary::-webkit-details-marker {
    display: none;
}

.report-multi-filter > summary::after {
    content: "▾";
    position: absolute;
    inset-inline-end: 13px;
    top: 10px;
}

.report-multi-filter[open] {
    z-index: 120;
}

.report-multi-filter-menu {
    position: absolute;
    z-index: 121;
    top: calc(100% + 5px);
    inset-inline: 0;
    max-height: 300px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
}

.report-multi-filter-menu label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 7px;
    cursor: pointer;
}

.report-multi-filter-menu label:hover {
    background: #eff6ff;
}

.report-multi-filter-menu input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    flex: 0 0 auto;
}

.report-multi-search {
    position: sticky;
    top: 0;
    z-index: 1;
    width: 100%;
    min-height: 38px;
    margin: 0 0 7px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}

.report-multi-search:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(37, 126, 245, .15);
}

.report-multi-option[hidden],
.report-multi-empty[hidden] {
    display: none;
}

.report-multi-empty {
    margin: 8px;
    color: var(--muted);
    font-size: 13px;
}

.report-multi-clear {
    width: 100%;
    margin-bottom: 5px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: #eaf3ff;
    color: #1264cf;
    font-weight: 700;
    text-align: start;
    cursor: pointer;
}

.decision-product-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.decision-campaign-toggle {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1264cf;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.decision-campaign-detail-row > td {
    padding: 0 !important;
    background: #f8fbff;
}

.decision-campaign-detail {
    padding: 14px;
    border-inline-start: 4px solid #2583f7;
}

.decision-product-owners {
    margin-bottom: 10px;
    color: #334155;
}

.decision-campaign-detail .table-wrap {
    max-height: 300px;
    border: 1px solid #dbe5f1;
    border-radius: 10px;
    background: #fff;
}

.decision-campaign-detail table {
    min-width: 1500px;
}

.decision-campaign-detail td small {
    display: block;
    margin-top: 3px;
    color: #64748b;
}

.decision-saved-filters {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid #dbe5f1;
}

.decision-save-filter-form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.decision-save-filter-form label {
    flex: 1 1 280px;
}

.decision-saved-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.decision-saved-filter-list > div {
    display: flex;
    align-items: center;
    gap: 4px;
}

.decision-saved-filter-list form {
    margin: 0;
}
.stock-order-count-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(360px, 3fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.stock-status-picker {
    min-width: 0;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.stock-status-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.stock-status-options .checkbox-row {
    width: auto;
    margin: 0;
}

@media (max-width: 900px) {
    .stock-order-count-controls {
        grid-template-columns: 1fr;
    }
}
.report-filter-panel .report-ad-spend-basis {
    display: none !important;
}
.campaign-spend-total-row th {
    background: #eaf3ff;
    border-top: 2px solid #7eb6f5;
    color: #10233f;
    font-weight: 800;
    white-space: nowrap;
}

/* Orders: compact server-backed filters live in each table column. */
.orders-filter-reset-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.8rem;
}

.orders-filter-reset-row span {
    margin-inline-end: auto;
}

.orders-column-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.orders-column-heading > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orders-column-filter {
    position: relative;
    flex: 0 0 auto;
}

.orders-column-filter > summary {
    position: relative;
    display: inline-flex;
    width: 27px;
    min-width: 27px;
    height: 27px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #c6d2e1;
    border-radius: 7px;
    background: #fff;
    color: #526174;
    box-shadow: var(--input-shadow);
    cursor: pointer;
    list-style: none;
}

.orders-column-filter > summary::-webkit-details-marker {
    display: none;
}

.orders-column-filter > summary:hover,
.orders-column-filter > summary:focus-visible,
.orders-column-filter[open] > summary,
.orders-column-filter.is-active > summary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    outline: none;
}

.orders-column-filter > summary small {
    position: absolute;
    top: -7px;
    inset-inline-end: -7px;
    display: inline-flex;
    min-width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 9px;
    line-height: 1;
}

.orders-column-filter > summary small[hidden] {
    display: none;
}

.orders-column-filter-menu {
    position: fixed;
    z-index: 7000;
    display: grid;
    gap: 9px;
    width: min(380px, calc(100vw - 16px));
    max-height: min(430px, calc(100vh - 16px));
    padding: 12px;
    overflow: auto;
    border: 1px solid #b9c9dc;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.24);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: normal;
    text-align: start;
}

.orders-column-filter-menu > strong {
    font-size: 0.9rem;
}

.orders-column-filter-menu > label {
    display: grid;
    gap: 5px;
    margin: 0;
    font-weight: 700;
}

.orders-column-filter-menu input[type="text"],
.orders-column-filter-menu input[type="search"],
.orders-column-filter-menu input[type="number"],
.orders-column-filter-menu input[type="date"] {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.orders-column-filter-all {
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #bfd7f6;
    border-radius: 8px;
    background: #edf5ff;
    color: #1264cf;
    font-weight: 800;
    text-align: start;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.orders-column-filter-all input {
    width: auto;
    min-height: 0;
    margin: 0;
}

.orders-column-filter-all:hover,
.orders-column-filter-all:focus-visible {
    border-color: var(--primary);
    background: var(--primary-soft);
    outline: none;
}

.orders-column-filter-options {
    display: grid;
    gap: 3px;
    max-height: 260px;
    overflow-y: auto;
    padding: 2px;
}

.orders-column-filter-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--ink);
    cursor: pointer;
    font-weight: 600;
}

.orders-column-filter-options label:hover {
    background: var(--surface-hover);
}

.orders-column-filter-options input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
}

.orders-column-filter-options span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.orders-column-filter-options [hidden],
.orders-column-filter-empty[hidden] {
    display: none;
}

.orders-column-filter-empty {
    margin: 6px;
    color: var(--muted);
}

.orders-column-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.orders-table[data-orders-table] {
    width: 2400px;
    min-width: 2400px;
}

.orders-table-no-actions[data-orders-table] {
    width: 2140px;
    min-width: 2140px;
}

.orders-table[data-orders-table] th,
.orders-table[data-orders-table] td {
    width: auto;
}

.orders-table[data-orders-table] thead th {
    overflow: visible;
}

.orders-col-select { width: 38px; }
.orders-col-order { width: 150px; }
.orders-col-page { width: 118px; }
.orders-col-customer { width: 240px; }
.orders-col-product { width: 270px; }
.orders-col-owner { width: 150px; }
.orders-col-country { width: 105px; }
.orders-col-governorate { width: 120px; }
.orders-col-town { width: 130px; }
.orders-col-warehouse { width: 135px; }
.orders-col-delivery-company { width: 155px; }
.orders-col-quantity { width: 62px; }
.orders-col-total { width: 105px; }
.orders-col-status { width: 155px; }
.orders-col-created-by { width: 140px; }
.orders-col-source { width: 125px; }
.orders-col-created { width: 112px; }
.orders-col-actions { width: 224px; }

@media (max-width: 760px) {
    .orders-control-bar,
    .orders-export-actions,
    .orders-bulk-delete-form {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .orders-export-actions {
        margin: 0;
    }

    .orders-control-bar > *,
    .orders-export-actions > *,
    .orders-bulk-delete-form > * {
        width: 100%;
    }

    .orders-filter-reset-row {
        align-items: stretch;
        flex-direction: column;
    }

    .orders-filter-reset-row span {
        margin: 0;
    }
}
