/* ============================================================
   Farasync Admin Dashboard Styles
   Modern, compact, RTL-friendly, Vazirmatn typography
   ============================================================ */

/* ---------- Font Face ---------- */
/* v1.0.0: font-display changed from swap to block. With swap the browser
   painted the fallback font (Tahoma/Segoe UI) first and swapped to Vazirmatn
   later — the reported font flash. Combined with the new <link rel=preload>
   hints in admin_head, block guarantees the page never renders with the
   wrong font: text waits for Vazirmatn (usually <100ms thanks to preload). */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}
/* v1.0.0 (user report: «رفرش می‌کنم انگار اول یک CSS لود می‌شه و بعد از
   چند ثانیه یک CSS دیگر — سایزها کمی فرق می‌کنند»): the visible swap is
   the FALLBACK FONT (Tahoma) being replaced by Vazirmatn when the woff2
   files land. The jump exists because the two fonts carry different line
   metrics. This metric-compatible face wraps the local fallback inside the
   SAME family-aware stack ('Vazirmatn Fallback' below): its line box is
   forced to Vazirmatn's real metrics (ascent 2100/2048 = 102.54%,
   descent 1100/2048 = 53.71%, no line gap — read from the shipped woff2),
   and size-adjust nudges the glyphs toward Vazirmatn's proportions, so a
   swap no longer shifts line heights / sizes — it becomes nearly
   invisible. */
@font-face {
    font-family: 'Vazirmatn Fallback';
    src: local('Tahoma');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
    size-adjust: 110%;
    ascent-override: 102.54%;
    descent-override: 53.71%;
    line-gap-override: 0%;
}

/* ---------- Root variables ---------- */
:root {
    --farasync-bg: #f0f0f1;
    --farasync-surface: #ffffff;
    --farasync-border: #e0e0e0;
    --farasync-border-strong: #c3c4c7;
    --farasync-text: #1d2327;
    --farasync-text-muted: #646970;
    --farasync-text-light: #8c8f94;
    --farasync-primary: #2271b1;
    --farasync-primary-hover: #135e96;
    --farasync-primary-light: #f0f6fc;
    --farasync-success: #00a32a;
    --farasync-success-bg: #edfaef;
    --farasync-success-border: #c3f4cd;
    --farasync-danger: #d63638;
    --farasync-danger-bg: #fcf0f1;
    --farasync-danger-border: #f5c2c7;
    --farasync-warning: #dba617;
    --farasync-radius-sm: 4px;
    --farasync-radius: 6px;
    --farasync-radius-lg: 10px;
    --farasync-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --farasync-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --farasync-font: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    --farasync-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
}

/* ---------- Base ---------- */
.farasync-wrap {
    max-width: 1416px; /* v1.0.0: Increased 20% from 1180px */
    margin: 0 auto;
    font-family: var(--farasync-font);
    color: var(--farasync-text);
    box-sizing: border-box;
}
.farasync-wrap *,
.farasync-wrap *::before,
.farasync-wrap *::after {
    box-sizing: border-box;
}
.farasync-wrap .dashicons {
    font-family: dashicons;
}

/* ---------- Header ---------- */
.farasync-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 20px 24px;
    margin-bottom: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f6f7f9 100%);
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius-lg);
    box-shadow: var(--farasync-shadow-sm);
}
.farasync-header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}
.farasync-logo {
    width: 52px;
    height: 52px;
    border-radius: var(--farasync-radius);
    background: linear-gradient(135deg, var(--farasync-primary) 0%, #6c4ab8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.25);
}
.farasync-logo .dashicons {
    color: #fff;
    font-size: 28px;
    width: 28px;
    height: 28px;
}
.farasync-header-title h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.3;
    color: var(--farasync-text);
    padding: 0;
    letter-spacing: -0.3px;
}
.farasync-subtitle {
    margin: 0;
    color: var(--farasync-text-muted);
    font-size: 13px;
    line-height: 1.5;
    max-width: 540px;
}
.farasync-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* v1.0.0: Active-mode badge — shows whether the site currently runs in
   distribution (توزیع) or receive (دریافت) mode. Sits next to the endpoint
   badge in the page header, above the tab list. */
.farasync-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--farasync-text);
    white-space: nowrap;
    box-shadow: var(--farasync-shadow-sm);
}
.farasync-mode-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
.farasync-mode-badge.mode-distribution {
    border-color: #46b450;
    color: #2a7a32;
    background: #edfaef;
}
.farasync-mode-badge.mode-distribution .dashicons {
    color: #46b450;
}
.farasync-mode-badge.mode-receive {
    border-color: #72aee6;
    color: #1d4f7c;
    background: #f0f6fc;
}
.farasync-mode-badge.mode-receive .dashicons {
    color: #2271b1;
}
.farasync-mode-badge.mode-both {
    border-color: #dba617;
    color: #8a6116;
    background: #fff8e5;
}
.farasync-mode-badge.mode-both .dashicons {
    color: #dba617;
}
.farasync-mode-badge.mode-none {
    opacity: 0.75;
}
.farasync-mode-badge.mode-none .dashicons {
    color: var(--farasync-text-muted);
}

/* ---------- Tabs ---------- */
.farasync-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--farasync-border-strong);
    margin: 0 0 0 0;
    padding: 0;
}
.farasync-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--farasync-text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--farasync-radius-sm) var(--farasync-radius-sm) 0 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    top: 1px;
}
.farasync-tab:hover {
    color: var(--farasync-primary);
    background: var(--farasync-primary-light);
}
.farasync-tab.is-active {
    color: var(--farasync-text);
    background: var(--farasync-surface);
    border-color: var(--farasync-border-strong);
    font-weight: 700;
}
.farasync-tab .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

/* ---------- Tab Panels ---------- */
.farasync-tab-panels {
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border-strong);
    border-top: none;
    padding: 24px;
    min-height: 300px;
    box-shadow: var(--farasync-shadow-sm);
}
.farasync-tab-panel {
    display: none;
}
.farasync-tab-panel.is-active {
    display: block;
}

/* ---------- Section intro ---------- */
.farasync-section-intro {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: var(--farasync-primary-light);
    border-inline-start: 3px solid var(--farasync-primary);
    border-radius: var(--farasync-radius-sm);
    font-size: 13px;
    color: var(--farasync-text);
}

/* ---------- Form table reset ---------- */
.farasync-form .form-table {
    margin-top: 8px;
}
.farasync-form .form-table th {
    width: 220px;
    padding: 16px 10px 16px 0;
    vertical-align: top;
    font-weight: 600;
    color: var(--farasync-text);
}
.farasync-form .form-table td {
    padding: 16px 10px;
    vertical-align: top;
}
.farasync-form .form-table tr {
    border-bottom: 1px solid var(--farasync-border);
}
.farasync-form .form-table tr:last-child {
    border-bottom: none;
}
.farasync-wrap .description {
    color: var(--farasync-text-muted);
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.5;
}

/* ---------- Radio group (compact inline layout) ---------- */
.farasync-radio-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin: 0;
    border: 0;
    padding: 0;
}
.farasync-radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.farasync-radio-option-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    padding: 6px 12px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    transition: all 0.15s ease;
    font-size: 13px;
}
.farasync-radio-option-inline:hover {
    border-color: var(--farasync-primary);
    background: var(--farasync-primary-light);
}
.farasync-radio-option-inline input[type="radio"] {
    cursor: pointer;
    margin: 0;
}
.farasync-radio-option-inline strong {
    color: var(--farasync-text);
    font-weight: 600;
}

/* ---------- Info tip (popup) ---------- */
.farasync-info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: var(--farasync-text-light);
    position: relative;
    transition: color 0.15s ease;
}
.farasync-info-tip:hover {
    color: var(--farasync-primary);
}
.farasync-info-tip svg {
    width: 16px;
    height: 16px;
}
.farasync-info-tip .farasync-tip-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    inset-inline-start: 50%;
    transform: translateX(-50%);
    background: #1d2327;
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--farasync-radius);
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
html[dir="rtl"] .farasync-info-tip .farasync-tip-popup {
    transform: translateX(50%);
}
.farasync-info-tip .farasync-tip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1d2327;
}
.farasync-info-tip.is-active .farasync-tip-popup {
    opacity: 1;
    visibility: visible;
}

/* ---------- Old radio group (kept for backward compatibility) ---------- */
.farasync-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    border: 0;
    padding: 0;
}
.farasync-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 0;
}
.farasync-radio-option:hover {
    border-color: var(--farasync-primary);
    background: var(--farasync-primary-light);
}
.farasync-radio-option input[type="radio"] {
    margin-top: 3px;
    cursor: pointer;
}
.farasync-radio-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.farasync-radio-text strong {
    font-size: 13px;
    color: var(--farasync-text);
    font-weight: 600;
}
.farasync-radio-desc {
    font-size: 12px;
    color: var(--farasync-text-muted);
    line-height: 1.4;
}

/* ---------- Fields grid (chips) ---------- */
.farasync-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin: 4px 0;
}
.farasync-field-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 0;
    font-size: 12px;
}
.farasync-field-chip:hover {
    border-color: var(--farasync-primary);
}
.farasync-field-chip.is-checked {
    background: var(--farasync-primary-light);
    border-color: var(--farasync-primary);
}
.farasync-field-chip.is-locked {
    background: var(--farasync-success-bg);
    border-color: var(--farasync-success-border);
    cursor: not-allowed;
}
.farasync-field-chip input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}
.farasync-chip-label {
    flex: 1;
    color: var(--farasync-text);
}
.farasync-chip-lock {
    color: var(--farasync-success);
    display: inline-flex;
}
.farasync-chip-lock .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}

/* ---------- Field suffix ---------- */
.farasync-field-suffix {
    color: var(--farasync-text-muted);
    font-size: 12px;
    margin-inline-start: 6px;
}

/* ---------- Form actions ---------- */
.farasync-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 0 0;
    margin-top: 8px;
    border-top: 1px solid var(--farasync-border);
}
.farasync-form-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.farasync-form-actions .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

/* ---------- API Keys: Toolbar ---------- */
.farasync-keys-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
/* v1.0.0 (Round Y5): grouped toolbar actions — the buttons sit TOGETHER
   in one row on the toolbar's far side instead of spreading apart. */
.farasync-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
/* v1.0.0 (Round Y5): short tabs (debug, settings…) must still pin the
   credit footer to the floor of the dashboard box — the active panel
   stretches to fill the box's min-height so the footer never floats. */
.farasync-tab-panels {
    display: flex;
    flex-direction: column;
}
.farasync-tab-panels .farasync-tab-panel.is-active {
    flex: 1 0 auto;
}
/* v1.0.0: Logs-tab actions group — debug toggle + Clear Logs side by side.
   In RTL the group sits at the left end; inside the group the first child
   renders rightmost, so the debug toggle appears to the RIGHT of Clear Logs. */
.farasync-logs-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.farasync-logs-actions .farasync-debug-mini-toggle {
    margin-top: 0;
    padding: 0;
    opacity: 1;
}
.farasync-logs-actions .farasync-debug-mini-toggle .farasync-debug-mini-label {
    font-size: 13px;
    line-height: 1;
}
.farasync-keys-desc {
    margin: 0;
    color: var(--farasync-text-muted);
    font-size: 13px;
}
#farasync-add-key-btn,
#farasync-add-key-btn-empty {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#farasync-add-key-btn .dashicons,
#farasync-add-key-btn-empty .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

/* ---------- API Keys: Table ---------- */
.farasync-keys-table {
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius);
    overflow: hidden;
    margin-top: 0;
}
.farasync-keys-table th {
    font-weight: 600;
    color: var(--farasync-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 10px;
}
.farasync-keys-table td {
    padding: 12px 10px;
    font-size: 13px;
    vertical-align: middle;
}
.farasync-keys-table .col-name { width: 18%; }
.farasync-keys-table .col-preview { width: 18%; }
.farasync-keys-table .col-status { width: 8%; }
.farasync-keys-table .col-fields { width: 22%; }
.farasync-keys-table .col-lastused { width: 12%; }
.farasync-keys-table .col-actions { width: 22%; }

.farasync-key-code {
    font-family: var(--farasync-mono);
    font-size: 11px;
    background: var(--farasync-bg);
    padding: 3px 8px;
    border-radius: var(--farasync-radius-sm);
    word-break: break-all;
    color: var(--farasync-text-muted);
}
.farasync-more-fields {
    color: var(--farasync-text-light);
    font-size: 11px;
    background: var(--farasync-bg);
    padding: 1px 5px;
    border-radius: var(--farasync-radius-sm);
}
/* v1.0.0 (user request): the keys LIST now shows each key's exclusive
   representative discount as a small violet pill — the admin no longer has
   to open the edit modal to learn whether a rep has a discount. */
.farasync-discount-chip {
    display: inline-block;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    padding: 1px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.farasync-never {
    color: var(--farasync-text-light);
    font-style: italic;
}

/* ---------- Badges ---------- */
.farasync-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.5;
}
.farasync-badge-active {
    background: var(--farasync-success-bg);
    color: var(--farasync-success);
    border: 1px solid var(--farasync-success-border);
}
.farasync-badge-inactive {
    background: var(--farasync-danger-bg);
    color: var(--farasync-danger);
    border: 1px solid var(--farasync-danger-border);
}

/* ---------- Row actions ---------- */
.farasync-row-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center; /* v1.0.0: the 20px mini-switch rides the TOP of the 30px icon buttons without this */
}
.farasync-action-btn {
    margin: 0 !important;
    font-size: 11px !important;
    padding: 2px 8px !important;
    line-height: 1.6 !important;
    height: auto !important;
}

/* ---------- Empty state ---------- */
.farasync-empty-row td {
    padding: 40px 20px !important;
    text-align: center;
}
.farasync-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--farasync-text-muted);
}
/* release polish: direct child only — the old descendant
   selector also restyled the «+» inside the Add-Source button. */
.farasync-empty-state > .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
    color: var(--farasync-text-light);
    opacity: 0.6;
}
.farasync-empty-state .button .dashicons {
    width: 15px;
    height: 15px;
    font-size: 15px;
    color: #000000;
    opacity: 1;
}
.farasync-empty-state p {
    margin: 0;
    font-size: 13px;
    max-width: 360px;
}

/* ---------- Modals ---------- */
.farasync-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
}
.farasync-modal-content {
    background-color: var(--farasync-surface);
    padding: 28px 32px;
    border-radius: var(--farasync-radius-lg);
    width: 100%;
    max-width: 640px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    margin: auto;
}
.farasync-modal-content h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    padding: 0;
    color: var(--farasync-text);
}
.farasync-modal-close {
    color: var(--farasync-text-light);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    position: absolute;
    top: 16px;
    inset-inline-end: 20px;
    transition: color 0.15s ease;
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.farasync-modal-close:hover {
    color: var(--farasync-text);
    background: var(--farasync-bg);
}
.farasync-modal-content .form-table th {
    width: 160px;
    font-weight: 600;
}
.farasync-key-warning {
    color: var(--farasync-danger);
    font-weight: 600;
    background: var(--farasync-danger-bg);
    padding: 10px 14px;
    border-radius: var(--farasync-radius);
    border: 1px solid var(--farasync-danger-border);
    font-size: 12px;
    line-height: 1.6;
    margin: 0 0 16px;
}
#farasync-revealed-key {
    width: 100%;
    font-family: var(--farasync-mono);
    font-size: 13px;
    padding: 12px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    color: var(--farasync-text);
    resize: vertical;
}
.farasync-reveal-actions {
    display: flex;
    gap: 8px;
    margin: 16px 0 0;
}

/* ---------- Field labels (in modal) ---------- */
.farasync-field-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius-sm);
    margin-bottom: 4px;
    width: auto !important;
    font-size: 12px;
    opacity: 1;
}
.farasync-field-label.farasync-not-global {
    opacity: 0.55;
    background: transparent;
}
.farasync-field-label-text {
    flex: 1;
}
.farasync-field-note {
    font-size: 10px;
    color: var(--farasync-text-light);
    background: var(--farasync-bg);
    padding: 1px 5px;
    border-radius: var(--farasync-radius-sm);
}
#farasync-key-fields-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 4px;
    margin-top: 8px;
}

/* ---------- Buttons ---------- */
.farasync-wrap .button-primary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.farasync-wrap .button .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

/* ============================================================
   RTL adjustments
   ============================================================ */
html[dir="rtl"] .farasync-wrap {
    text-align: right;
}
html[dir="rtl"] .farasync-tab {
    top: 1px;
}
html[dir="rtl"] .farasync-section-intro {
    border-inline-start: 3px solid var(--farasync-primary);
    border-right: 3px solid var(--farasync-primary);
    border-left: none;
}
html[dir="rtl"] .farasync-radio-text,
html[dir="rtl"] .farasync-chip-label,
html[dir="rtl"] .farasync-key-warning {
    text-align: right;
}
html[dir="rtl"] .farasync-modal-close {
    inset-inline-end: 20px;
}
html[dir="rtl"] .farasync-action-btn {
    margin: 0 0 0 4px !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media screen and (max-width: 1024px) {
    .farasync-form .form-table th {
        width: 180px;
    }
    .farasync-fields-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}
@media screen and (max-width: 782px) {
    .farasync-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .farasync-tabs {
        flex-wrap: wrap;
    }
    .farasync-tab {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 12px;
    }
    .farasync-tab .dashicons {
        display: none;
    }
    .farasync-tab-panels {
        padding: 16px;
    }
    /* Form table → stacked */
    .farasync-form .form-table th,
    .farasync-form .form-table td {
        display: block;
        width: 100% !important;
        padding: 8px 0;
    }
    .farasync-form .form-table th {
        padding-bottom: 4px;
        padding-top: 16px;
    }
    .farasync-fields-grid {
        grid-template-columns: 1fr;
    }
    .farasync-keys-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .farasync-keys-table thead,
    .farasync-keys-table tbody,
    .farasync-keys-table tr,
    .farasync-keys-table th,
    .farasync-keys-table td {
        display: table-cell;
    }
    .farasync-row-actions {
        flex-direction: column;
        gap: 4px;
        align-items: center; /* v1.0.0: keep the mini-switch centered in the stacked fallback too */
    }
    .farasync-action-btn {
        width: 100%;
        text-align: center;
    }
    .farasync-modal {
        padding: 16px;
    }
    .farasync-modal-content {
        padding: 20px;
    }
    #farasync-key-fields-list {
        grid-template-columns: 1fr;
    }
}
@media screen and (max-width: 480px) {
    .farasync-header-title h1 {
        font-size: 18px;
    }
    .farasync-keys-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    #farasync-add-key-btn {
        justify-content: center;
    }
}

/* ============================================================
   WordPress native overrides (subtle)
   ============================================================ */
.farasync-wrap .button,
.farasync-wrap .button-primary,
.farasync-wrap .button-secondary {
    font-family: var(--farasync-font);
    border-radius: var(--farasync-radius-sm);
    transition: all 0.15s ease;
}
.farasync-wrap input[type="text"],
.farasync-wrap input[type="number"],
.farasync-wrap select,
.farasync-wrap textarea {
    font-family: var(--farasync-font);
    border-radius: var(--farasync-radius-sm);
}
.farasync-wrap input[type="text"]:focus,
.farasync-wrap input[type="number"]:focus,
.farasync-wrap select:focus,
.farasync-wrap textarea:focus {
    border-color: var(--farasync-primary);
    box-shadow: 0 0 0 1px var(--farasync-primary);
}

/* Hide the default WordPress footer ("Thank you for creating with WordPress")
   only on the Farasync admin page, to keep the dashboard clean. */
body.toplevel_page_farasync-settings #wpfooter,
body.woocommerce_page_farasync-settings #wpfooter {
    display: none !important;
}

/* ============================================================
   Module Cards (Dashboard tab)
   ============================================================ */
.farasync-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.farasync-module-card {
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius-lg);
    padding: 20px;
    box-shadow: var(--farasync-shadow-sm);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.farasync-module-card.is-enabled {
    border-color: var(--farasync-primary);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.08);
}
.farasync-module-card.is-disabled {
    opacity: 0.85;
}
.farasync-module-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 3px;
    background: var(--farasync-border);
}
.farasync-module-card.is-enabled::before {
    background: var(--farasync-primary);
}
.farasync-module-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.farasync-module-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--farasync-radius);
    background: var(--farasync-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.farasync-module-card.is-enabled .farasync-module-icon {
    background: var(--farasync-primary);
}
.farasync-module-icon .dashicons {
    color: var(--farasync-primary);
    font-size: 22px;
    width: 22px;
    height: 22px;
}
.farasync-module-card.is-enabled .farasync-module-icon .dashicons {
    color: #fff;
}
.farasync-module-info {
    flex: 1;
}
.farasync-module-info h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--farasync-text);
}
.farasync-module-info p {
    margin: 0;
    font-size: 12px;
    color: var(--farasync-text-muted);
    line-height: 1.4;
}
.farasync-module-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--farasync-bg);
    border-radius: var(--farasync-radius);
}
.farasync-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.farasync-status-on {
    background: var(--farasync-success);
    box-shadow: 0 0 0 3px var(--farasync-success-bg);
}
.farasync-status-off {
    background: var(--farasync-text-light);
}
.farasync-status-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--farasync-text);
}
.farasync-module-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.farasync-stat {
    text-align: center;
    padding: 10px 8px;
    background: var(--farasync-bg);
    border-radius: var(--farasync-radius);
}
.farasync-stat-num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--farasync-text);
    line-height: 1.2;
}
.farasync-stat-label {
    display: block;
    font-size: 11px;
    color: var(--farasync-text-muted);
    margin-top: 2px;
}

/* ---------- Toggle Switch ---------- */
.farasync-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.farasync-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.farasync-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--farasync-text-light);
    transition: background-color 0.3s;
    border-radius: 24px;
}
.farasync-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    inset-inline-start: 3px;
    top: 3px;
    background-color: white;
    transition: transform 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.farasync-switch input:checked + .farasync-switch-slider {
    background-color: var(--farasync-primary);
}
.farasync-switch input:checked + .farasync-switch-slider:before {
    transform: translateX(20px);
}
html[dir="rtl"] .farasync-switch input:checked + .farasync-switch-slider:before {
    transform: translateX(-20px);
}

/* ---------- Mini Toggle (for API key rows) ---------- */
.farasync-mini-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    vertical-align: middle;
}
.farasync-mini-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.farasync-mini-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--farasync-text-light);
    transition: background-color 0.3s;
    border-radius: 20px;
}
.farasync-mini-switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    inset-inline-start: 3px;
    top: 3px;
    background-color: white;
    transition: transform 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.farasync-mini-switch input:checked + .farasync-mini-switch-slider {
    background-color: var(--farasync-success);
}
.farasync-mini-switch input:checked + .farasync-mini-switch-slider:before {
    transform: translateX(16px);
}
html[dir="rtl"] .farasync-mini-switch input:checked + .farasync-mini-switch-slider:before {
    transform: translateX(-16px);
}

/* v1.0.0 (user report): the keys-table ON/OFF switch also carried the
   .farasync-action-btn button skin, whose `height:auto !important` +
   `padding:2px 8px !important` stretched the 36x20 track into a fat pill
   (30px tall) that broke the knob geometry. This re-pins the switch to
   its own mini dimensions while keeping the class (the JS handler binds
   `.farasync-action-btn[data-action="toggle"]`). */
label.farasync-mini-switch.farasync-action-btn,
.farasync-mini-switch.farasync-action-btn {
    display: inline-block !important;
    width: 36px !important;
    height: 20px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: normal !important;
    vertical-align: middle !important;
    flex: 0 0 auto !important;
}

/* ---------- SVG Icons for row actions ---------- */
.farasync-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius-sm);
    background: var(--farasync-surface);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0 2px;
    color: var(--farasync-text-muted);
    vertical-align: middle;
}
.farasync-icon-btn:hover {
    background: var(--farasync-primary-light);
    border-color: var(--farasync-primary);
    color: var(--farasync-primary);
}
.farasync-icon-btn.farasync-icon-danger:hover {
    background: var(--farasync-danger-bg);
    border-color: var(--farasync-danger);
    color: var(--farasync-danger);
}
.farasync-icon-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ---------- Status indicator (SVG light) ---------- */
.farasync-status-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}
.farasync-status-light svg {
    width: 16px;
    height: 16px;
}
.farasync-status-light .farasync-light-on {
    fill: var(--farasync-success);
    filter: drop-shadow(0 0 3px var(--farasync-success));
}
.farasync-status-light .farasync-light-off {
    fill: var(--farasync-text-light);
}

/* ---------- Copy endpoint button ---------- */
.farasync-copy-endpoint {
    cursor: pointer;
    transition: all 0.15s ease;
}
.farasync-copy-endpoint:hover {
    background: var(--farasync-primary-light) !important;
    border-color: var(--farasync-primary) !important;
}
.farasync-copy-endpoint:active {
    transform: scale(0.98);
}
.farasync-copy-endpoint .dashicons {
    transition: color 0.2s;
}
.farasync-copy-endpoint:hover .dashicons {
    color: var(--farasync-primary);
}
.farasync-copy-endpoint.is-copied .dashicons {
    color: var(--farasync-success) !important;
}

/* ---------- API Key reveal modal: auto-copy textarea ---------- */
#farasync-revealed-key {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: all;
    -webkit-user-select: all;
}
#farasync-revealed-key:hover {
    border-color: var(--farasync-primary);
    background: var(--farasync-primary-light);
}
#farasync-revealed-key.is-copied {
    border-color: var(--farasync-success);
    background: var(--farasync-success-bg);
}

/* Warning pulse animation */
@keyframes farasync-warning-pulse {
    0%, 100% {
        background: var(--farasync-danger-bg);
        border-color: var(--farasync-danger-border);
        transform: scale(1);
    }
    50% {
        background: #fce8e8;
        border-color: var(--farasync-danger);
        transform: scale(1.02);
        box-shadow: 0 0 12px rgba(214, 54, 56, 0.3);
    }
}
.farasync-key-warning.farasync-warning-pulse {
    animation: farasync-warning-pulse 0.6s ease;
}

/* Close attempt counter */
.farasync-close-hint {
    font-size: 11px;
    color: var(--farasync-text-muted);
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

/* ---------- Dashboard Info ---------- */
.farasync-dashboard-info {
    margin-top: 24px;
}
.farasync-dashboard-info h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
}
.farasync-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}
.farasync-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    /* v1.0.0 (UI audit): without min-width:0 the nowrap endpoint URL forced
       the grid track to its min-content (~405px) and the whole document
       scrolled sideways on phones. */
    min-width: 0;
}
.farasync-info-item .dashicons {
    color: var(--farasync-primary);
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.farasync-info-item strong {
    display: block;
    font-size: 12px;
    color: var(--farasync-text);
    margin-bottom: 2px;
}
.farasync-info-item code {
    font-family: var(--farasync-mono);
    font-size: 11px;
    color: var(--farasync-text-muted);
    background: var(--farasync-bg);
    padding: 2px 6px;
    border-radius: 3px;
    word-break: break-all;
    /* v1.0.0 (UI audit): shrink + truncate instead of stretching the row. */
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* v1.0.0 (UI audit): the icon+text wrapper is the flex item that must be
   allowed to shrink — without it the nowrap endpoint URL kept the row at
   its min-content (~405px) and phones scrolled sideways. */
.farasync-info-item > div {
    min-width: 0;
}

/* ============================================================
   Divider & Notice
   ============================================================ */
.farasync-divider {
    border: none;
    border-top: 1px solid var(--farasync-border);
    margin: 24px 0;
}
.farasync-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--farasync-radius);
    margin-bottom: 16px;
}
.farasync-notice-info {
    background: var(--farasync-primary-light);
    border: 1px solid var(--farasync-primary);
}
.farasync-notice .dashicons {
    color: var(--farasync-primary);
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.farasync-notice p {
    margin: 0;
    font-size: 13px;
    color: var(--farasync-text);
}

/* ============================================================
   Sync Section
   ============================================================ */
.farasync-sync-section h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
}
.farasync-sync-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}
.farasync-sync-status {
    font-size: 13px;
    color: var(--farasync-text-muted);
}
.farasync-progress-wrap {
    margin: 16px 0;
}
.farasync-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--farasync-bg);
    border-radius: 4px;
    overflow: hidden;
}
.farasync-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--farasync-primary), #6c4ab8);
    transition: width 0.3s ease;
    border-radius: 4px;
}
.farasync-progress-text {
    text-align: center;
    font-size: 12px;
    color: var(--farasync-text-muted);
    margin-top: 6px;
}
.farasync-sync-results {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--farasync-success-bg);
    border: 1px solid var(--farasync-success-border);
    border-radius: var(--farasync-radius);
    font-size: 13px;
    color: var(--farasync-text);
}
.farasync-sync-results.has-errors {
    background: var(--farasync-danger-bg);
    border-color: var(--farasync-danger-border);
}

/* ============================================================
   Logs Table
   ============================================================ */
.farasync-logs-table {
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius);
    overflow: hidden;
}
.farasync-logs-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 10px;
}
.farasync-logs-table td {
    padding: 10px;
    font-size: 13px;
}
.farasync-logs-table code {
    font-family: var(--farasync-mono);
    font-size: 11px;
    background: var(--farasync-bg);
    padding: 2px 6px;
    border-radius: 3px;
}
.farasync-badge-info {
    background: var(--farasync-primary-light);
    color: var(--farasync-primary);
    border: 1px solid var(--farasync-primary);
}

/* ============================================================
   v1.0.0 (item 3): amber tint for "open" invoices.
   Sales Report tab → every row whose SOURCE order status is
   anything but «تکمیل شده»; Representative Invoices tab →
   every row without the «تکمیل شده» status. The nav badges
   count exactly the same rows, so the number on the tab and
   the highlighted rows always tell the same story.
   v1.0.0 (item 6, user request): the amber VERTICAL BAR
   (inset box-shadow) is GONE — only the row BACKGROUND keeps
   the tint; the column separators stay colorless.
   ============================================================ */
.farasync-sales-table tbody tr.farasync-row-open > td,
.farasync-invoices-table tbody tr.farasync-row-open > td {
    background: #fff8e6 !important;
}
.farasync-sales-table tbody tr.farasync-row-open:hover > td,
.farasync-invoices-table tbody tr.farasync-row-open:hover > td {
    background: #fff2cd !important;
}

/* ============================================================
   v1.0.0 (items 3 + 4): the INLINE STATUS EDITOR on the sales
   report + representative invoices rows — a badge + caret that
   opens a tiny status menu in place; picking a status writes
   it to the WooCommerce order behind the row.
   ============================================================ */
.farasync-st-cell {
    position: relative;
    white-space: nowrap;
}
.farasync-st-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}
.farasync-st-edit .farasync-st-caret {
    font-size: 9px;
    line-height: 1;
    opacity: .55;
}
.farasync-st-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 2px);
    inset-inline-start: 0;
    min-width: 132px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .14);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.farasync-st-menu[hidden] {
    display: none;
}
.farasync-st-opt {
    display: block;
    width: 100%;
    text-align: start;
    background: transparent;
    border: 0;
    border-radius: 5px;
    padding: 5px 9px;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
    color: #1d2327;
}
.farasync-st-opt:hover {
    background: #f0f6fc;
    color: #2271b1;
}
.farasync-st-opt.is-current {
    background: #f0f6fc;
    font-weight: 600;
    color: #2271b1;
}
/* the print + trash cell on the invoices rows — icons keep a small gap */
.farasync-invoices-table .farasync-inv-print-cell {
    white-space: nowrap;
    line-height: 1; /* v1.0.0: kill the baseline strut that piled phantom space under the icons */
}
.farasync-invoices-table .farasync-inv-print-cell .farasync-print-btn + .farasync-del-btn {
    margin-inline-start: 6px;
}

/* ====================================================================
 * v1.0.0 (user reports) — vertical alignment repairs.
 *
 * (a) Representative invoices: a dead empty band piled up BELOW the
 *     print/trash icons on taller rows (two-line product names, wrapped
 *     cells). The admin theme's stylesheet pins table cells to
 *     vertical-align:top, so the extra row height clumped under the
 *     icon cell while the buttons rode the top edge. Re-pin every
 *     scroll-table cell to the middle (theme-proof !important, scoped
 *     to the .farasync-table-scroll wrappers only) — the extra height
 *     now splits evenly above/below, exactly as the design intends.
 * (b) The keys-table ON/OFF switch sits at the vertical middle of its
 *     neighboring buttons in EVERY layout: the desktop flex row gains
 *     align-items:center (its 20px track rode the 30px buttons' top
 *     edge), the ≤782px column stack centers it too, and the mobile
 *     key-card footer groups the switch beside the buttons instead of
 *     spreading it to the far edge (admin-command-center.css).
 * ==================================================================== */
.farasync-table-scroll > table th,
.farasync-table-scroll > table td {
    vertical-align: middle !important;
}
.farasync-invoices-table .farasync-inv-print-cell .farasync-print-btn,
.farasync-invoices-table .farasync-inv-print-cell .farasync-del-btn {
    vertical-align: middle;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#farasync-toast-container {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.farasync-toast {
    min-width: 280px;
    max-width: 400px;
    padding: 12px 16px 12px 14px;
    border-radius: var(--farasync-radius);
    background: var(--farasync-surface);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: farasync-toast-in 0.3s ease;
    border-inline-start: 4px solid var(--farasync-text-light);
    font-family: var(--farasync-font);
    font-size: 13px;
}
.farasync-toast.farasync-toast-success {
    border-inline-start-color: var(--farasync-success);
}
.farasync-toast.farasync-toast-error {
    border-inline-start-color: var(--farasync-danger);
}
.farasync-toast.farasync-toast-info {
    border-inline-start-color: var(--farasync-primary);
}
.farasync-toast .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.farasync-toast-success .dashicons {
    color: var(--farasync-success);
}
.farasync-toast-error .dashicons {
    color: var(--farasync-danger);
}
.farasync-toast-info .dashicons {
    color: var(--farasync-primary);
}
.farasync-toast-message {
    flex: 1;
    line-height: 1.4;
}
@keyframes farasync-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes farasync-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}
.farasync-toast.is-leaving {
    animation: farasync-toast-out 0.3s ease forwards;
}

/* ---------- Button loading state ---------- */
.farasync-wrap .button.is-loading {
    pointer-events: none;
    opacity: 0.7;
}
.farasync-wrap .button.is-loading .dashicons {
    animation: farasync-spin 0.8s linear infinite;
}
@keyframes farasync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 782px) {
    .farasync-modules-grid {
        grid-template-columns: 1fr;
    }
    .farasync-module-stats {
        grid-template-columns: 1fr 1fr;
    }
    .farasync-info-grid {
        grid-template-columns: 1fr;
    }
    #farasync-toast-container {
        inset-inline-end: 12px;
        bottom: 12px;
    }
    .farasync-toast {
        min-width: calc(100vw - 24px);
    }
}

/* ============================================================
   Source Cards (Destination tab)
   ============================================================ */
.farasync-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.farasync-source-empty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    text-align: center;
}
.farasync-source-card {
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius-lg);
    padding: 16px;
    box-shadow: var(--farasync-shadow-sm);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.farasync-source-card.is-enabled {
    border-color: var(--farasync-primary);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.08);
}
.farasync-source-card.is-disabled {
    opacity: 0.7;
}
.farasync-source-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.farasync-source-card-info {
    flex: 1;
    min-width: 0;
}
.farasync-source-name {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--farasync-text);
    line-height: 1.3;
}
.farasync-source-url {
    font-family: var(--farasync-mono);
    font-size: 11px;
    color: var(--farasync-text-muted);
    background: var(--farasync-bg);
    padding: 3px 8px;
    border-radius: var(--farasync-radius-sm);
    word-break: break-all;
    display: block;
}
.farasync-source-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.farasync-source-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.farasync-badge-method {
    background: #6366f1;
    color: #fff;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
}
.farasync-toast {
    max-width: 480px;
    white-space: pre-wrap;
}
.farasync-toast-message {
    line-height: 1.5;
    font-size: 13px;
}
.farasync-source-card-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.farasync-source-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.farasync-source-action-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
.farasync-source-sync-progress {
    margin-top: 12px;
}
.farasync-source-sync-progress .farasync-progress-bar {
    height: 6px;
}

@media screen and (max-width: 782px) {
    .farasync-sources-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Health Section
   ============================================================ */
.farasync-health-section {
    margin-top: 24px;
}
.farasync-health-section h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
}
.farasync-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}
.farasync-health-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--farasync-surface);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    transition: all 0.15s ease;
}
.farasync-health-card.status-healthy {
    border-color: var(--farasync-success);
}
.farasync-health-card.status-warning {
    border-color: var(--farasync-warning);
}
.farasync-health-card.status-critical {
    border-color: var(--farasync-danger);
}
.farasync-health-card.status-unknown {
    opacity: 0.6;
}
.farasync-health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.farasync-health-dot.healthy {
    background: var(--farasync-success);
    box-shadow: 0 0 4px var(--farasync-success);
}
.farasync-health-dot.warning {
    background: var(--farasync-warning);
}
.farasync-health-dot.critical {
    background: var(--farasync-danger);
    box-shadow: 0 0 4px var(--farasync-danger);
}
.farasync-health-dot.unknown {
    background: var(--farasync-text-light);
}
.farasync-health-info {
    flex: 1;
    min-width: 0;
}
.farasync-health-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--farasync-text);
}
.farasync-health-msg {
    font-size: 11px;
    color: var(--farasync-text-muted);
    margin-top: 2px;
}
.farasync-health-meta {
    font-size: 10px;
    color: var(--farasync-text-light);
    margin-top: 2px;
}

/* ============================================================
   Source Schedule Toggle
   ============================================================ */
.farasync-source-schedule {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--farasync-border);
}
.farasync-schedule-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--farasync-text-muted);
}
.farasync-schedule-toggle input {
    margin: 0;
    cursor: pointer;
}
.farasync-schedule-label {
    font-weight: 600;
}
.farasync-schedule-interval {
    font-size: 12px;
    padding: 2px 6px;
    height: auto;
    line-height: 1.4;
    border-radius: var(--farasync-radius-sm);
}
.farasync-schedule-interval:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Background sync active state */
.farasync-source-card.is-syncing {
    border-color: var(--farasync-primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}
.farasync-source-card.is-syncing .farasync-source-sync-progress {
    display: block !important;
}
.farasync-source-card.is-syncing .farasync-source-cancel-btn {
    display: inline-flex !important;
}
.farasync-source-card.is-syncing .farasync-source-action-btn[data-action="bg-sync"] {
    display: none;
}

/* ============================================================
   Price Rules Modal
   ============================================================ */
.farasync-modal-wide {
    max-width: 960px !important; /* v1.0.0: +20% from 800px */
}
.farasync-price-rules-list {
    margin-bottom: 16px;
}
.farasync-price-rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    margin-bottom: 8px;
    transition: all 0.15s ease;
}
.farasync-price-rule-item:hover {
    border-color: var(--farasync-primary);
}
.farasync-price-rule-item.is-inactive {
    opacity: 0.55;
}
.farasync-price-rule-info {
    flex: 1;
    min-width: 0;
}
.farasync-price-rule-desc {
    font-size: 13px;
    font-weight: 600;
    color: var(--farasync-text);
}
.farasync-price-rule-meta {
    font-size: 11px;
    color: var(--farasync-text-muted);
    margin-top: 2px;
}
.farasync-price-rule-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.farasync-price-rule-empty {
    text-align: center;
    padding: 24px;
    color: var(--farasync-text-muted);
    font-size: 13px;
}
.farasync-price-rule-add-btn {
    margin-top: 12px;
}
.farasync-pr-value-suffix {
    font-size: 12px;
    color: var(--farasync-text-muted);
    margin-inline-start: 4px;
}

/* ================================================================
   v1.0.0: Price Rule form input widths + remove spinner arrows.
   - Value field (when in toman/fixed mode) needs to be wide enough
     to comfortably enter currency amounts.
   - Min profit / Max profit fields also accept toman amounts and
     need to be wide.
   - Remove the up/down spinner arrows from these number inputs
     (user requested — they prefer typing the value directly).
   ================================================================ */
.farasync-pr-value-input,
.farasync-pr-profit-input {
    width: 160px !important;
    /* Remove spinner arrows — WebKit (Chrome, Safari, Edge) */
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    margin: 0;
}
/* Firefox: hide the spinner arrows explicitly. */
.farasync-pr-value-input::-webkit-outer-spin-button,
.farasync-pr-value-input::-webkit-inner-spin-button,
.farasync-pr-profit-input::-webkit-outer-spin-button,
.farasync-pr-profit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.farasync-pr-value-input[type=number],
.farasync-pr-profit-input[type=number] {
    -moz-appearance: textfield;
}

/* ================================================================
   Product Sync Manager (v1.0.0)
   ================================================================ */
.farasync-modal-xwide {
    max-width: 1320px !important; /* v1.0.0: +20% from 1100px */
}
.farasync-sync-manager-summary {
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}
.farasync-sync-manager-summary .farasync-sm-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.farasync-sync-manager-summary .farasync-sm-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--farasync-text-muted);
}
.farasync-sync-manager-summary .farasync-sm-summary-value {
    font-weight: 600;
    font-size: 14px;
}
.farasync-sync-manager-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--farasync-bg);
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
}
.farasync-sync-manager-filters select,
.farasync-sync-manager-filters input {
    max-width: 180px;
}
.farasync-sync-manager-selection {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #fff7e6;
    border: 1px solid #ffb900;
    border-radius: var(--farasync-radius);
}
.farasync-sm-selected-count {
    font-weight: 600;
    color: #b58000;
}
.farasync-sync-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    background: #fff;
}
.farasync-sm-product-card {
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 10px;
    background: #fff;
    transition: all 0.15s ease;
    position: relative;
}
.farasync-sm-product-card.is-selected {
    border-color: var(--farasync-primary);
    background: #f0f7ff;
}
.farasync-sm-product-card.is-imported {
    border-left: 3px solid #46b450;
}
.farasync-sm-product-card.is-needs-update {
    border-left: 3px solid #ffb900;
}
.farasync-sm-product-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--farasync-radius);
    margin-bottom: 8px;
    background: var(--farasync-bg);
}
.farasync-sm-product-image-placeholder {
    width: 100%;
    height: 120px;
    border-radius: var(--farasync-radius);
    margin-bottom: 8px;
    background: var(--farasync-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--farasync-text-muted);
    font-size: 24px;
}
.farasync-sm-product-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.farasync-sm-product-meta {
    font-size: 12px;
    color: var(--farasync-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.farasync-sm-product-price {
    font-weight: 700;
    color: var(--farasync-text);
}
.farasync-sm-product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.farasync-sm-product-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.farasync-sm-badge-instock { background: #d4edda; color: #155724; }
.farasync-sm-badge-outofstock { background: #f8d7da; color: #721c24; }
.farasync-sm-badge-imported { background: #d1ecf1; color: #0c5460; }
.farasync-sm-badge-needs-update { background: #fff3cd; color: #856404; }
.farasync-sm-badge-not-imported { background: #e2e3e5; color: #383d41; }
.farasync-sm-badge-type { background: #f0f0f1; color: #50575e; text-transform: capitalize; }
.farasync-sm-product-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
}
.farasync-sm-product-categories {
    font-size: 11px;
    color: var(--farasync-text-muted);
    margin-top: 4px;
}
.farasync-sync-manager-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0;
}
.farasync-sync-manager-options {
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 16px;
    margin: 16px 0;
    background: var(--farasync-bg);
}
.farasync-sm-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media screen and (max-width: 782px) {
    .farasync-sm-options-grid {
        grid-template-columns: 1fr;
    }
}
.farasync-sm-option-group h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
}
.farasync-sm-option-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    cursor: pointer;
}
.farasync-sm-progress-log {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 8px;
    margin-top: 8px;
    font-size: 12px;
    background: #fff;
}
.farasync-sm-progress-log-item {
    padding: 2px 0;
    border-bottom: 1px solid #f0f0f1;
}
.farasync-sm-progress-log-item:last-child {
    border-bottom: none;
}
.farasync-sm-progress-log-item.status-created { color: #46b450; }
.farasync-sm-progress-log-item.status-updated { color: #007cba; }
.farasync-sm-progress-log-item.status-skipped { color: #999; }
.farasync-sm-progress-log-item.status-failed { color: #d63638; }
.farasync-sync-manager-summary-result {
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 16px;
    margin: 16px 0;
    background: #fff;
}
.farasync-sm-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media screen and (max-width: 782px) {
    .farasync-sm-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.farasync-sm-item-results {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--farasync-border);
    border-radius: var(--farasync-radius);
    padding: 8px;
    font-size: 12px;
    background: var(--farasync-bg);
}
.farasync-sm-item-result {
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f1;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.farasync-sm-item-result:last-child {
    border-bottom: none;
}

/* v1.0.0: Auto-sync status badges */
.farasync-source-auto-sync {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--farasync-border);
}
.farasync-source-auto-sync .farasync-sm-product-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
}

/* BATCH-5 Part B: Source-down notice + Stop-selling-if-down checkbox. */
.farasync-source-down-notice {
    background: #fff8e5 !important;
    border-left-color: #dba617 !important;
}
.farasync-source-down-notice p {
    line-height: 1.5;
}
.farasync-source-stop-selling {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f9f9f9;
    border: 1px dashed #d0d0d0;
    border-radius: 4px;
}
.farasync-source-stop-selling-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
}
.farasync-source-stop-selling-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* BATCH-5 Part C: Webhook diagnostics panel. */
.farasync-webhook-diagnostics {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
}
.farasync-webhook-diagnostics table.wp-list-table {
    margin-top: 4px;
    margin-bottom: 8px;
}
.farasync-webhook-diagnostics h4 {
    font-size: 13px;
    color: #23282d;
}
.farasync-webhook-diagnostics .farasync-sm-product-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
}

/* ====================================================================
 * v1.0.0 — Sales Report tab: click-to-copy tracking codes, source
 * order status badges, print links (user request #2)
 * ==================================================================== */
.farasync-sales-tracking {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    direction: ltr;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: copy;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.farasync-sales-tracking:hover {
    background: #e2e8f0;
    box-shadow: 0 1px 3px rgba(71, 85, 105, 0.25);
}
.farasync-sales-tracking.is-copied {
    background: #475569;
    border-color: #334155;
    color: #fff;
}
.farasync-sales-tracking .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    opacity: 0.55;
}
.farasync-sales-tracking.is-copied .dashicons {
    opacity: 1;
}
.farasync-src-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.farasync-src-status.is-ok {
    background: #edfaef;
    color: #1b6e2d;
    border: 1px solid #b8e6c0;
}
.farasync-src-status.is-info {
    background: #eef4ff;
    color: #1d4ed8;
    border: 1px solid #c3d7fb;
}
.farasync-src-status.is-warn {
    background: #fdf6e7;
    color: #996800;
    border: 1px solid #f5de9b;
}
.farasync-src-status.is-err {
    background: #fdebeb;
    color: #b32d2e;
    border: 1px solid #f5c7c7;
}
/* v1.0.0: the «در انتظار پرداخت» badge is wrapped in a link to the source
 * site's representative panel (orders tab). The wrapper only adds the
 * pointer affordance — the pill itself keeps its warn palette. */
.farasync-src-status-link {
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    border-radius: 20px;
    transition: transform .12s ease, box-shadow .12s ease;
}
.farasync-src-status-link:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(153, 104, 0, .25);
}
.farasync-src-status-link:focus-visible {
    outline: 2px solid #996800;
    outline-offset: 1px;
}
.farasync-sales-print-link {
    cursor: pointer;
    text-decoration: none;
}
.farasync-sales-print-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
}
.farasync-sales-col-check {
    text-align: center;
}
.farasync-sales-col-check input[type="checkbox"] {
    margin: 0;
}

/* ================================================================
   v1.0.0 — user feedback round
   ================================================================ */

/* ---------- #2: key-rotation old/new chips (no more ambiguous arrow) */
.farasync-rot-key {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.farasync-rot-key + .farasync-rot-key {
    margin-top: 5px;
}
.farasync-rot-tag {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 999px;
}
.farasync-rot-new .farasync-rot-tag {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}
.farasync-rot-old .farasync-rot-tag {
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.farasync-rot-new .farasync-key-code {
    font-weight: 700;
    color: #15803d;
}
.farasync-rot-old .farasync-key-code {
    color: #94a3b8;
    text-decoration: line-through;
    text-decoration-color: rgba(148, 163, 184, 0.55);
}

/* ---------- #4: ONE uniform printer-icon button everywhere ----------
   Every print action in the plugin (invoices tab row, sales tab row,
   invoice modal, bulk toolbar buttons, representative panel) uses this
   exact same icon-only control. */
.farasync-print-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #d7dfe8 !important;
    border-radius: 7px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
    cursor: pointer;
    text-decoration: none !important;
    vertical-align: middle;
    transition: all 0.15s ease;
}
.farasync-print-btn .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
}
.farasync-print-btn:hover,
.farasync-print-btn:focus {
    color: #4f46e5 !important;
    background: #eef2ff !important;
    border-color: #a5b4fc !important;
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.18) !important;
}
.farasync-print-btn:active {
    transform: translateY(1px);
}
/* Small count badge for bulk-print buttons (only rendered when > 0). */
.farasync-print-btn .farasync-print-count {
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    margin-inline-start: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    background: #4f46e5;
    border-radius: 999px;
}

/* ====================================================================
 * v1.0.0 (#3) — redesigned Problem Items (اقلام دارای مشکل) list.
 * Card-like rows with a clear title (product name), a status badge
 * that says WHY the item keeps failing, and honest actions.
 * All selectors are farasync-scoped so no theme can break them.
 * ==================================================================== */
.farasync-issues-table .farasync-issue-row > td {
    vertical-align: top;
    padding: 12px 10px;
}
.farasync-issue-col-title {
    min-width: 200px;
}
/* v1.0.0 (Round Y5): product name + identifier share ONE line. */
.farasync-issue-titleline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}
.farasync-issue-title {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.5;
    margin-bottom: 0;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
/* v1.0.0 (Round Y8): the identifier and the «unknown product» label are
   PLAIN TEXT now — no chip boxes in the product column (user request).
   Explicit none-values also beat the wp-admin bare `code` styling. */
.farasync-issue-title .farasync-issue-noname {
    color: #92400e;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-style: normal;
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
}
.farasync-issue-ident {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #475569;
    flex: 0 0 auto;
}
.farasync-issue-ident code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}
/* v1.0.0 (Round Y8): bulk-selection column. */
.farasync-issues-table .farasync-issue-col-check {
    width: 36px;
    text-align: center;
    vertical-align: middle;
    padding: 6px 4px;
}
/* «Delete Selected» reads as a destructive action. */
#farasync-issues-bulk-delete-btn {
    color: #b32d2e;
    border-color: #e7baba;
}
#farasync-issues-bulk-delete-btn:hover {
    background: #fdf1f1;
    border-color: #d63638;
    color: #8a2424;
}
/* v1.0.0 (Round Y10): the profit-chart hover tooltip — plugin font
   (beats the admin theme's bare-element rules), dark card, 3 lines. */
.farasync-stats-chart {
    position: relative;
}
.farasync-chart-tip {
    position: absolute;
    z-index: 30;
    pointer-events: none;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 12.5px;
    line-height: 1.9;
    white-space: nowrap;
    box-shadow: 0 10px 26px rgba(2, 6, 23, .35);
    opacity: 0;
    transition: opacity .15s ease;
    font-family: 'Vazirmatn', 'Vazirmatn Fallback', Tahoma, sans-serif !important;
}
.farasync-chart-tip.is-on {
    opacity: 1;
}
.farasync-chart-tip .farasync-chart-tip-date {
    font-weight: 700;
    color: #e0e7ff;
}
.farasync-chart-tip .farasync-chart-tip-profit {
    font-weight: 700;
    color: #86efac;
}
.farasync-chart-tip .farasync-chart-tip-profit.is-loss {
    color: #fca5a5;
}
/* v1.0.0 (Round Y11): vertical date strip under every chart bar — one
   rotated label per column, mirroring the canvas flex layout (same gap,
   same column count) so each date sits exactly under its own bar.
   rotate(-90deg) puts the Persian day number at the TOP (reads downward). */
/* v1.0.0 (Round Y11b): three FIXED label sizes per device class (user
   spec: 11px desktop / 9px tablet / 7px mobile — WP admin breakpoints
   782px & 600px) and a tighter strip (margin-top 1px, shorter cells) so
   the rotated dates sit visibly closer to the bars. JS no longer sets an
   inline font-size, so these rules are authoritative. */
.farasync-chart-axis {
    display: flex;
    gap: 2px;
    margin-top: 1px;
    height: 56px;
}
.farasync-chart-axis-cell {
    flex: 1;
    min-width: 8px;
    position: relative;
}
.farasync-chart-axis-txt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    white-space: nowrap;
    line-height: 1;
    font-size: 11px;
    color: #64748b;
    font-family: 'Vazirmatn', 'Vazirmatn Fallback', Tahoma, sans-serif;
}
@media (max-width: 782px) {
    .farasync-chart-axis {
        height: 48px;
    }
    .farasync-chart-axis-txt {
        font-size: 9px;
    }
}
@media (max-width: 600px) {
    .farasync-chart-axis {
        height: 40px;
    }
    .farasync-chart-axis-txt {
        font-size: 7px;
    }
    /* v1.0.0 (Y11b): 30 columns × inline min-width:8px (+ gap) cannot fit a
       phone-width canvas — the rows overflowed and the tall bars were
       clipped off-screen. Let the cells shrink and tighten the gap so the
       strip keeps mirroring the canvas exactly (both shrink together). */
    .farasync-chart-canvas > div {
        min-width: 0 !important; /* beats the inline min-width:8px */
    }
    .farasync-chart-canvas {
        gap: 1px !important; /* beats the inline gap:2px */
    }
    .farasync-chart-axis {
        gap: 1px;
    }
    .farasync-chart-axis-cell {
        min-width: 0;
    }
}
.farasync-issue-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    font-size: 12.3px;
    font-weight: 600;
    white-space: nowrap;
}
.farasync-issue-source .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #0e7490;
}
.farasync-issue-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.7;
    margin-bottom: 6px;
}
.farasync-issue-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
.farasync-issue-badge.is-gone {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.farasync-issue-badge.is-error {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.farasync-issue-why {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.7;
    word-break: break-word;
}
.farasync-issue-why-label {
    font-weight: 700;
    color: #4b5563;
}
.farasync-issue-col-meta {
    font-size: 12px;
    color: #475569;
    white-space: nowrap;
}
.farasync-issue-fails b {
    color: #b91c1c;
    font-size: 13px;
}
.farasync-issue-last {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 11.5px;
}
.farasync-issue-last code {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
}
/* v1.0.0 (Round Y5): flex row so the big bare × and the small Retry
   button align on one baseline vertically centered. */
.farasync-issue-col-actions {
    white-space: nowrap;
    text-align: left; /* RTL: buttons hug the left edge of the cell */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}
/* v1.0.0 (Round Y5): the × is a bare red glyph — the WP «button» square
   (background/border) is GONE, and the sign is ~2.5× bigger than before. */
.farasync-issue-x {
    appearance: none;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 2px !important;
    min-width: 32px !important;
    min-height: 36px !important;
    font-size: 32px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    vertical-align: middle;
    color: #b32d2e !important;
    cursor: pointer;
}
.farasync-issue-x:hover {
    background: none !important;
    color: #7f1d1d !important;
    border: none !important;
    opacity: 0.85;
}
.farasync-issue-x:focus {
    outline: 1px dotted #b32d2e;
    outline-offset: 2px;
}
.farasync-issue-row.is-gone .farasync-issue-retry {
    opacity: 0.75;
}

/* ====================================================================
 * v1.0.0 (Round Y5) — dashboard charts always render: centered note
 * over the (flat) baseline when the 30-day window has zero activity.
 * ==================================================================== */
.farasync-stats-chart {
    position: relative;
}
.farasync-chart-empty-note {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 124px; /* overlays the 120px canvas + its bottom border */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}
.farasync-chart-empty-note::before {
    content: '';
    position: absolute;
    inset: 6px 12px;
    background: rgba(248, 250, 252, 0.72);
    border-radius: 10px;
    z-index: -1;
}

/* ====================================================================
 * v1.0.0 (#6) — invoices tab: key-name chip beside the rep name
 * ==================================================================== */
.farasync-inv-key-chip {
    display: inline-block;
    margin-inline-start: 4px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f0f4fa;
    border: 1px solid #d9e2ef;
    color: #46608a;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    vertical-align: middle;
}

/* ====================================================================
 * v1.0.0 (Round K) — branded credit footer (bottom of every admin tab).
 * Same markup as the representative panel footer; slate strip + gradient
 * brand name, matches the command-center palette.
 * ==================================================================== */
.farasync-credit-footer {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 20px -24px -24px;
    padding: 14px 24px 16px;
    border-top: none;
    font-size: 11.5px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.015em;
    user-select: none;
    background:
        radial-gradient(circle at 88% 10%, rgba(167, 139, 250, 0.35), transparent 32%),
        linear-gradient(121deg, #312e81 0%, #5b21b6 46%, #1d4ed8 100%);
}
.farasync-credit-footer::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 0;
    opacity: 0.22;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(90deg, #000, transparent 78%);
    mask-image: linear-gradient(90deg, #000, transparent 78%);
}
.farasync-credit-footer > * {
    position: relative;
    z-index: 1;
}
.farasync-credit-footer .farasync-credit-logo {
    display: block;
    height: 25px;
    width: auto;
    padding: 0;
    border: none;
    background: none;
    border-radius: 4px;
    filter: drop-shadow(0 0 5px rgba(147, 197, 253, 0.45));
}
.farasync-credit-brand {
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    color: #e0e7ff; /* fallback if text-gradient is unsupported */
    background: linear-gradient(135deg, #e0e7ff 0%, #f5d0fe 55%, #bfdbfe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.farasync-credit-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    flex: 0 0 auto;
}
.farasync-credit-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.farasync-credit-labs {
    font-weight: 700;
    color: #e0e7ff;
    direction: ltr;
    unicode-bidi: embed;
}

/* v1.0.0: footer bleed follows the box padding on small screens */
@media (max-width: 782px) {
    .farasync-credit-footer {
        margin: 14px -16px -16px;
        padding: 13px 16px 15px;
    }
}

/* ====================================================================
 * v1.0.0 (Round Y12) — tablet/mobile repair for the wide admin tables
 * (logs, imported, invoices, sales, issues). Previously the 10-12 column
 * tables were squeezed into a ~300-700px panel: the <th> texts wrapped
 * character-by-character («ا/ف/ز/ا/ی/ش»), the header row split into two,
 * and every body row collapsed into a ~600px-tall vertical scatter of
 * cells. Each table now sits inside a .farasync-table-scroll wrapper
 * (added in admin-page.php): the table keeps its natural width and the
 * WRAPPER scrolls horizontally — columns never collapse again.
 *
 * v1.0.0 (user report): the date cell wrapped mid-value on phones —
 * the anti-wrap list still pointed at td:nth-child(9), but the tracking
 * (v1.0.0) + editable-status (v1.0.0) columns pushed تاریخ to child
 * 10. The status select is inline-sized, so only the date needs the
 * nowrap guard now.
 * ==================================================================== */
.farasync-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.farasync-table-scroll > table {
    min-width: 680px; /* floor for 6-10 column tables; wider on phones */
    margin-bottom: 0;
}
/* v1.0.0 (Round Y12) THE REAL CULPRIT: the admin theme's narrow-width
   stylesheet flips table rows to flex and cells to block
   (tr{display:flex}, th/td{display:block}) — that is what scattered the
   cells vertically and dropped the last header onto a second line, NOT
   simple squeezing. Restore the real table model inside the wrappers
   (!important so the theme rule loses regardless of load order). */
.farasync-table-scroll table {
    display: table !important;
}
.farasync-table-scroll tr {
    display: table-row !important;
}
.farasync-table-scroll th,
.farasync-table-scroll td {
    display: table-cell !important;
}
.farasync-table-scroll > table th {
    white-space: nowrap; /* headers can never letter-stack again */
}
/* v1.0.0 (item 3, user report): the EMPTY-state column artifact — pin the
   header band to one surface and make .farasync-empty-row fully inert so no
   per-column white strip or hover inset line can appear on the «عملیات»
   column while a report table is empty. Mirror of the command-center block;
   harmless when the command-center copy wins the cascade anyway. */
.farasync-wrap .wp-list-table thead th,
.farasync-wrap .wp-list-table thead th:last-child,
.farasync-wrap .wp-list-table thead th.farasync-imported-actions-col {
    background: #f8fafc !important;
}
.farasync-wrap .wp-list-table tbody tr.farasync-empty-row,
.farasync-wrap .wp-list-table tbody tr.farasync-empty-row:hover,
.farasync-wrap .wp-list-table tbody tr.farasync-empty-row td,
.farasync-wrap .wp-list-table tbody tr.farasync-empty-row:hover td {
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: 0 !important;
}
/* v1.0.0: badges/pills/inline buttons must keep their words together —
   in a squeezed column the status pill wrapped one-word-per-line and
   turned into a tall blob (the «در سایت مبدا حذف شده» tower). */
.farasync-table-scroll .farasync-issue-badge,
.farasync-table-scroll .farasync-badge,
.farasync-table-scroll .farasync-sm-product-badge,
.farasync-table-scroll .farasync-inv-key-chip,
.farasync-table-scroll .farasync-sales-tracking,
.farasync-table-scroll td .button,
.farasync-table-scroll td .farasync-print-btn {
    white-space: nowrap;
}
/* v1.0.0: dates/amounts/counts break mid-value at hyphens when their
   column runs narrow («08-26-2029 20:43» wrapped onto three lines).
   Column orders — sales: 2 order#, 3 src#, 4 date, 6 items, 7-9 amounts;
   invoices: 2 order#, 5 items, 6-7 amounts, 10 date (v1.0.0: was 9
   before the tracking + editable-status columns landed). */
.farasync-sales-table td:nth-child(2),
.farasync-sales-table td:nth-child(3),
.farasync-sales-table td:nth-child(4),
.farasync-sales-table td:nth-child(6),
.farasync-sales-table td:nth-child(7),
.farasync-sales-table td:nth-child(8),
.farasync-sales-table td:nth-child(9),
.farasync-invoices-table td:nth-child(2),
.farasync-invoices-table td:nth-child(5),
.farasync-invoices-table td:nth-child(6),
.farasync-invoices-table td:nth-child(7),
.farasync-invoices-table td:nth-child(10) {
    white-space: nowrap;
}
/* the sales table carries ~12 columns (order, date, customer, product,
   qty, amounts, statuses, tracking, print) — give it more floor */
.farasync-table-scroll > table.farasync-sales-table {
    min-width: 880px;
}
.farasync-table-scroll > table.farasync-invoices-table {
    min-width: 760px;
}

/* v1.0.0: the date-filter rows (sales + invoices tabs) — on phones the
   two 170px-capped date inputs + labels + buttons wrapped with ragged
   gaps. Let the inputs share the row proportionally instead. */
@media (max-width: 600px) {
    .farasync-logs-filter {
        row-gap: 8px;
    }
    .farasync-logs-filter input[type="date"] {
        flex: 1 1 128px;
        max-width: none !important; /* beats the inline max-width:170px */
        width: auto;
    }
}

/* v1.0.0: the grouped action buttons (CSV / retry-all / bulk-delete /
   refresh — Y5's .farasync-toolbar-actions) had NO flex-wrap: on phones
   the row stayed ~505px wide and dragged the whole page 170px past the
   viewport. Let the buttons wrap onto extra lines. */
.farasync-toolbar-actions {
    flex-wrap: wrap;
    row-gap: 8px;
}
/* same disease, second host: the issues tab's inline-styled action row
   (<div style="display:flex;gap:8px"> inside .farasync-keys-toolbar) —
   the inline style owns display/gap but NOT flex-wrap, so a stylesheet
   rule may add the wrapping. */
.farasync-keys-toolbar > div {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* ==========================================================================
   v1.0.0: INLINE filter chips (invoices tab + sales report)
   A plain-text label that opens a small tick-list popover. NO extra apply
   button — the tables reload instantly on every change. Shares the same
   class contract as the rep-panel chips in representative.css, so the two
   surfaces stay visually consistent.
   ========================================================================== */
.farasync-fchip {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.farasync-fchip-btn {
    border: 1px dashed transparent;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    padding: 3px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.farasync-fchip-btn:hover {
    background: #f1f5f9;
}
.farasync-fchip.is-active .farasync-fchip-btn {
    border-color: #2271b1;
    background: #f0f6fc;
    color: #2271b1;
}
.farasync-fchip-caret {
    font-size: 10px;
    opacity: .6;
}
.farasync-fchip-count {
    font-weight: 700;
    color: #2271b1;
}
.farasync-fchip-pop {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    z-index: 9990;
    min-width: 180px;
    max-height: 280px;
    overflow: auto;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
    padding: 6px;
    display: flex;
    flex-direction: column;
}
/* v1.0.0 (user bug report): display:flex DEFEATED the hidden attribute —
   every popover rendered permanently open and clicking could not close it.
   The [hidden] rule outranks the display declaration above and restores
   the closed-by-default / click-to-toggle behaviour. */
.farasync-fchip-pop[hidden] {
    display: none;
}
/* v1.0.0 (user request): type-ahead search inside the representative
   chip — the first letters of the rep name or site filter the list. */
.farasync-fchip-search {
    width: 100%;
    box-sizing: border-box;
    margin: 2px 0 6px;
    padding: 5px 9px;
    border: 1px solid #dcdcde;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    background: #f8fafc;
}
.farasync-fchip-search:focus {
    border-color: #2271b1;
    outline: none;
    background: #fff;
}
.farasync-fchip-nores {
    padding: 6px 8px;
    font-size: 12px;
    color: #94a3b8;
}
.farasync-fchip-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 12.5px;
    color: #1e293b;
    cursor: pointer;
    white-space: nowrap;
}
.farasync-fchip-opt:hover {
    background: #f1f5f9;
}
.farasync-fchip-opt-all {
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
    padding-top: 8px;
    color: #64748b;
}

/* =====================================================================
   v1.0.0 (user request): «چراغ» LED — the chip options no longer draw
   the native checkbox/radio tick (on some setups it only repainted after
   an outside click). The native input stays in the DOM (visually hidden,
   keyboard-working) so the whole state contract is untouched; the light
   is a CLASS-driven dot (.is-on) so it paints INSTANTLY on click.
   Off = cool gray; On = the same green the key-status lights use.
   ===================================================================== */
.farasync-fchip-opt input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.farasync-fchip-opt .farasync-led {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    transition: background 140ms ease, box-shadow 140ms ease;
}
.farasync-fchip-opt.is-on .farasync-led {
    background: var(--farasync-success, #22c55e);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16), 0 0 6px rgba(34, 197, 94, 0.55);
}
.farasync-fchip-opt.is-on {
    color: #0f172a;
    font-weight: 600;
}

/* =====================================================================
   v1.0.0 (user request): CLICK-THE-ROW SELECTION — the invoices, sales
   and failed-items tables select their row when the row BODY is clicked,
   not only the checkbox. The pointer + the empty-state reset keep the
   affordance honest.
   ===================================================================== */
.farasync-invoices-table tbody tr,
.farasync-sales-table tbody tr,
.farasync-issues-table tbody tr {
    cursor: pointer;
}
.farasync-invoices-table tbody tr.farasync-empty-row,
.farasync-sales-table tbody tr.farasync-empty-row,
.farasync-issues-table tbody tr.farasync-empty-row {
    cursor: default;
}
/* v1.0.0: notification deep-link landing highlight — the targeted row
   pulses twice so the eye lands on it instantly. */
@keyframes farasync-row-flash {
    0%, 100% { background-color: transparent; }
    25%, 65% { background-color: #f0f6fc; }
    45%, 85% { background-color: #dbeafe; }
}
tr.farasync-row-flash > td,
tr.farasync-row-flash > th {
    animation: farasync-row-flash 2.4s ease-in-out 1;
}

/* v1.0.0 (user request): the «یاداشت» badge NO LONGER sits inside the
   details button's label — it floats on the button's TOP-LEFT corner
   (position:absolute on a relative wrapper). Amber while the note is
   unread, muted gray once the admin has opened the details once. The
   modal's inline badge (inside the note box title) keeps the pill look. */
.farasync-inv-view-wrap {
    position: relative;
    display: inline-block;
}
/* v1.0.0 (item 4): the per-row delete icon sits beside the details
   button inside the Actions cell — same 6px gap the note badge uses. */
.farasync-inv-view-wrap .farasync-inv-del-row {
    margin-inline-start: 6px;
    vertical-align: middle;
}
.farasync-note-badge {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.7;
    vertical-align: middle;
}
.farasync-note-badge.is-corner {
    position: absolute;
    top: -9px;
    left: -9px; /* physical LEFT — the user asked for the top-left corner */
    inset-inline-start: auto;
    margin: 0;
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
}
.farasync-note-badge.is-unread {
    background: #fef3c7;
    color: #92400e;
    box-shadow: 0 0 0 1px #fcd34d inset, 0 1px 4px rgba(15, 23, 42, 0.22);
}
.farasync-note-badge.is-read {
    background: #e2e8f0;
    color: #475569;
}
.farasync-rep-note-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-inline-start: 4px solid #6366f1;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 14px;
}
.farasync-rep-note-box h3 {
    margin: 0 0 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.farasync-rep-note-box .farasync-rep-note-text {
    margin: 0;
    white-space: pre-line;
    line-height: 1.9;
}

/* =====================================================================
   v1.0.0 (user request): the INVOICE DETAILS POPUP redesign — compact
   and tidy on desktop AND mobile. Chips strip → 2-column info cards →
   note box → items table → totals card. All RTL-safe (logical physics
   kept minimal; numbers use an explicit LTR code style).
   v1.0.0 (user request): TIGHTER info cards (phone + postcode merge
   into the customer card, rep site inline, address|shipping share one
   row) so the note + items boxes get more room; the popup itself is a
   flex column — the body scrolls while the three action buttons stay
   pinned in ONE row above the brand footer (they must never fall onto
   the page footer on mobile).
   ===================================================================== */
#farasync-invoice-modal .farasync-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px);
    padding: 24px 28px 0;
    overflow: hidden;
}
#farasync-invoice-modal .farasync-modal-content h2 {
    flex: 0 0 auto;
    margin-bottom: 12px;
    font-size: 17px;
}
#farasync-invoice-modal .farasync-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-inline-end: 2px;
}
#farasync-invoice-modal #farasync-invoice-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 12px 0 14px;
    border-top: 1px solid #e8edf3;
}
#farasync-invoice-modal #farasync-invoice-actions .button {
    margin: 0;
}
#farasync-invoice-modal .farasync-invoice-mark-shipped-btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-align: center;
}
#farasync-invoice-modal .farasync-credit-footer {
    flex: 0 0 auto;
    margin: 0 -28px 0;
    padding: 10px 24px 12px;
    border-radius: 0 0 var(--farasync-radius-lg) var(--farasync-radius-lg);
}
#farasync-invoice-content .fs-inv-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}
#farasync-invoice-content .fs-inv-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    color: #334155;
    line-height: 1.8;
}
#farasync-invoice-content .fs-inv-chip .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
    color: #64748b;
}
#farasync-invoice-content .fs-inv-chip code {
    background: transparent;
    padding: 0;
    font-size: 12px;
    color: #334155;
}
#farasync-invoice-content .fs-inv-edit {
    margin-inline-start: auto;
    font-size: 12px;
    text-decoration: none;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    /* v1.0.0 (UI audit): real touch target without growing the chip row. */
    padding: 5px 8px;
    margin-block: -4px;
    min-height: 28px;
    box-sizing: border-box;
}
#farasync-invoice-content .fs-inv-edit .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
#farasync-invoice-content .fs-inv-edit:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
#farasync-invoice-content .fs-inv-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr; /* v1.0.0: address column wider */
    gap: 7px;
    margin-bottom: 10px;
}
#farasync-invoice-content .fs-inv-cell {
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    padding: 7px 10px;
    min-width: 0;
}
#farasync-invoice-content .fs-inv-cell-wide {
    grid-column: 1 / -1;
}
#farasync-invoice-content .fs-inv-lbl {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 2px;
}
#farasync-invoice-content .fs-inv-lbl .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
    color: #94a3b8;
}
#farasync-invoice-content .fs-inv-val {
    display: block;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.7;
    word-break: break-word;
}
#farasync-invoice-content .fs-inv-strong {
    font-weight: 700;
}
/* v1.0.0: the rep site rides INLINE after the name (was its own line). */
#farasync-invoice-content .fs-inv-site {
    display: inline;
    direction: ltr;
    unicode-bidi: embed;
    margin-inline-start: 2px;
    font-size: 11px;
    color: #2563eb;
    text-decoration: none;
    overflow-wrap: anywhere;
    /* v1.0.0 (UI audit): padding-block enlarges the tap area of an inline
       link WITHOUT changing the line box / popup compactness. */
    padding: 8px 6px;
}
/* v1.0.0: phone + postal code merged into the customer card. */
#farasync-invoice-content .fs-inv-tel {
    font-size: 12px;
    color: #0f172a;
}
#farasync-invoice-content .fs-inv-zip {
    color: #64748b;
    font-size: 11px;
    white-space: nowrap;
}
#farasync-invoice-content .fs-inv-zip code {
    font-size: 11.5px;
    color: #475569;
}
#farasync-invoice-content .fs-inv-site:hover {
    text-decoration: underline;
}
#farasync-invoice-content .fs-inv-ltr {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}
#farasync-invoice-content .fs-inv-val code,
#farasync-invoice-content .fs-inv-cell code {
    background: transparent;
    padding: 0;
    font-size: 12.5px;
    color: #0f172a;
}
#farasync-invoice-content .fs-inv-cost {
    color: #64748b;
    font-size: 12px;
}
#farasync-invoice-content .fs-inv-note-at {
    margin: 6px 0 0;
    font-size: 11px;
    color: #94a3b8;
}
#farasync-invoice-content .fs-inv-note-at code {
    background: transparent;
    padding: 0;
    color: #94a3b8;
    font-size: 11px;
}
#farasync-invoice-content .fs-inv-sec-title {
    margin: 4px 0 8px;
    font-size: 13px;
    color: #334155;
}
#farasync-invoice-content .fs-inv-items-wrap {
    border: 1px solid #e8edf3;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 12px;
}
#farasync-invoice-content table.fs-inv-items {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
#farasync-invoice-content table.fs-inv-items thead th {
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    text-align: start;
    padding: 7px 10px;
    border-bottom: 1px solid #e8edf3;
    white-space: nowrap;
}
#farasync-invoice-content table.fs-inv-items tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
}
#farasync-invoice-content table.fs-inv-items tbody tr:last-child td {
    border-bottom: 0;
}
#farasync-invoice-content table.fs-inv-items tbody tr:nth-child(even) td {
    background: #fafcff;
}
#farasync-invoice-content table.fs-inv-items td.fs-inv-item-name {
    white-space: normal;
    min-width: 120px;
    font-weight: 600;
    color: #0f172a;
}
#farasync-invoice-content table.fs-inv-items code {
    background: transparent;
    padding: 0;
    font-size: 11.5px;
    color: #475569;
}
#farasync-invoice-content .fs-inv-totals {
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    padding: 4px 12px;
    margin-bottom: 4px;
}
#farasync-invoice-content .fs-inv-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    font-size: 12.5px;
    color: #475569;
    border-bottom: 1px dashed #e2e8f0;
}
#farasync-invoice-content .fs-inv-total-row:last-child {
    border-bottom: 0;
}
#farasync-invoice-content .fs-inv-total-row b {
    color: #0f172a;
    font-size: 13px;
}
#farasync-invoice-content .fs-inv-total-grand {
    border-top: 1px solid #e2e8f0;
    border-bottom: 0;
    color: #0f172a;
    font-weight: 700;
}
#farasync-invoice-content .fs-inv-total-grand b {
    color: #047857;
    font-size: 15px;
}

/* --- mobile: single column, full-width cells, scrollable items ------- */
@media (max-width: 782px) {
    #farasync-invoice-modal .farasync-modal-content {
        padding: 16px 16px 0;
        max-height: calc(100vh - 32px);
    }
    #farasync-invoice-modal .farasync-credit-footer {
        margin: 0 -16px 0;
        padding: 9px 16px 11px;
    }
    #farasync-invoice-content .fs-inv-grid {
        grid-template-columns: 1fr;
    }
    #farasync-invoice-content .fs-inv-head {
        gap: 6px;
    }
    #farasync-invoice-content .fs-inv-edit {
        margin-inline-start: 0;
        width: 100%;
    }
    #farasync-invoice-content table.fs-inv-items thead th,
    #farasync-invoice-content table.fs-inv-items tbody td {
        padding: 6px 8px;
    }
}
@media (max-width: 480px) {
    #farasync-invoice-content .fs-inv-chip {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #farasync-invoice-content .fs-inv-cell {
        padding: 6px 9px;
    }
    /* v1.0.0 (user request): all THREE action buttons in ONE row that
       never wraps / never falls onto the footer — compact heights, the
       shipped button drops its icon and keeps the short label. */
    #farasync-invoice-modal #farasync-invoice-actions {
        gap: 6px;
        padding: 10px 0 12px;
    }
    #farasync-invoice-modal #farasync-invoice-actions .button {
        height: 34px;
        line-height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }
    #farasync-invoice-modal .farasync-invoice-mark-shipped-btn {
        font-size: 12.5px;
        padding: 0 6px;
    }
    #farasync-invoice-modal .farasync-invoice-mark-shipped-btn .dashicons {
        display: none;
    }
    #farasync-invoice-modal .farasync-print-btn {
        flex: 0 0 auto;
        padding: 0 8px;
    }
    #farasync-invoice-modal #farasync-invoice-close {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* ================================================================
   v1.0.0 (user request): universal table search + icon-only buttons
   ================================================================ */

/* The «جستجو…» box on the report filter rows / toolbars. */
input.farasync-table-search {
    width: 300px;
    max-width: 100%;
    min-height: 30px;
    padding: 3px 10px;
    border-radius: 4px;
    line-height: 1.6;
}
.farasync-logs-filter input.farasync-table-search,
.farasync-imported-filters input.farasync-table-search {
    flex: 0 1 300px;
    width: 300px;
}
.farasync-issues-searchrow input.farasync-table-search,
.farasync-admin-res-searchrow input.farasync-table-search {
    width: 320px;
    max-width: 100%;
}

/* CSV / refresh toolbar buttons are ICON-ONLY — square, the tooltip
   (title attribute) carries the label, aria-label keeps a11y. The shared
   .farasync-icon-btn box (30px square) already exists above and styles
   both the keys-row SVG buttons and these WP .button icons; here we only
   make the WP .button chrome and the dashicon fit the square. */
button.farasync-icon-btn.button,
a.farasync-icon-btn.button {
    padding: 0;
    line-height: 1;
}
.farasync-icon-btn .dashicons {
    margin: 0;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Rows hidden by the instant search + the «no match» row. */
tr.farasync-search-hidden {
    display: none !important;
}
tr.farasync-search-none td {
    padding: 14px 10px;
    text-align: center;
    color: #8c8f94;
}

@media (max-width: 782px) {
    input.farasync-table-search,
    .farasync-logs-filter input.farasync-table-search,
    .farasync-imported-filters input.farasync-table-search {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* ================================================================
   v1.0.0 — (1) ONE icon-button chrome everywhere (CSV / refresh /
   printer), (2) the expandable Source-Health card.
   ================================================================ */

/* ---- 1) Unified icon-button chrome --------------------------------
   The user approved the printer-button look (white bg, gray border,
   slate glyph, soft shadow) as THE standard for every icon-only
   control: CSV, refresh, global sync. WP's own .button chrome is
   overridden so wp-admin buttons match the front-end panel exactly.
   The inline SVG glyphs also cannot be hijacked by browser font
   replacements (the v1.0.0 dashicons «cloud» incident). */
button.farasync-icon-btn.button,
a.farasync-icon-btn.button,
a.farasync-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #d7dfe8 !important;
    border-radius: 7px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1;
    vertical-align: middle;
    transition: all 0.15s ease;
    box-sizing: border-box;
}
button.farasync-icon-btn.button:hover,
a.farasync-icon-btn.button:hover,
button.farasync-icon-btn.button:focus,
a.farasync-icon-btn.button:focus,
a.farasync-icon-btn:hover {
    color: #4f46e5 !important;
    background: #eef2ff !important;
    border-color: #a5b4fc !important;
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.18) !important;
}
.farasync-icon-btn svg,
.farasync-print-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0;
}
/* the global-sync button sits inside a th — keep it one row tall */
.farasync-imported-actions-header .farasync-icon-btn {
    width: 26px;
    height: 26px;
}
.farasync-imported-actions-header .farasync-icon-btn svg {
    width: 14px;
    height: 14px;
}

/* ---- 2) Expandable Source-Health card ---------------------------- */
/* v1.0.0: the card is now a header button + a collapsible body. The
   old single-row flex layout is replaced (block layout; the head is
   its own flex row). */
.farasync-health-card {
    display: block;
    padding: 0;
}
.farasync-hc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: 0;
    border-radius: inherit;
    cursor: pointer;
    text-align: right;
    font: inherit;
    color: inherit;
}
.farasync-hc-head:focus-visible {
    outline: 2px solid var(--farasync-primary);
    outline-offset: -2px;
}
.farasync-hc-headline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}
.farasync-hc-errcount {
    flex: 0 0 auto;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 999px;
}
/* v1.0.0: running-campaign badge on the health card — violet, its own
   link to that source's rep panel.
   v1.0.0 (user request): it is now a SMALL CORNER BADGE pinned to the
   card's top-left corner (floats over the card edge) instead of an
   inline item in the head row; it disappears the moment the campaign
   ends (the 5-minute poll no longer reports it active). */
.farasync-health-card {
    position: relative;
}
.farasync-hc-campaign {
    position: absolute;
    top: -9px;
    left: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border: 1px solid #a78bfa;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(139, 92, 246, .35);
}
.farasync-hc-campaign:hover,
.farasync-hc-campaign:focus {
    color: #ffffff;
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    text-decoration: none;
    box-shadow: 0 1px 6px rgba(124, 58, 237, .5);
}
/* v1.0.0 (user request): «تخفیف اختصاصی شما ۵٪» — the exclusive
   per-key discount, pinned to the card's TOP-RIGHT corner (mirrors the
   campaign badge on the opposite corner). */
.farasync-hc-discount {
    position: absolute;
    top: -9px;
    right: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #7a3f04;
    background: linear-gradient(135deg, #ffe9b8, #f5c66b);
    border: 1px solid #eab308;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(234, 179, 8, .35);
}

/* v1.0.0: the SAME two badges on the «دریافت» tab's source cards. The
   source card has overflow:hidden (the gradient top bar), so instead of
   floating over the edge they HANG from the top edge as small tabs;
   a sibling rule pushes the header content down so nothing overlaps. */
.farasync-source-card .farasync-src-corner {
    position: absolute;
    top: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    height: 21px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
}
.farasync-source-card .farasync-src-corner.is-start {
    left: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    border: 0;
    border-top: 0;
}
.farasync-source-card .farasync-src-corner.is-start:hover,
.farasync-source-card .farasync-src-corner.is-start:focus {
    color: #ffffff;
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    text-decoration: none;
}
.farasync-source-card .farasync-src-corner.is-end {
    right: 14px;
    color: #7a3f04;
    background: linear-gradient(135deg, #ffe9b8, #f5c66b);
    border: 0;
    border-top: 0;
}
.farasync-source-card .farasync-src-corner ~ .farasync-source-card-header {
    padding-top: 16px;
}
@media (max-width: 782px) {
    .farasync-source-card .farasync-src-corner ~ .farasync-source-card-header {
        padding-top: 14px;
    }
}
.farasync-hc-chevron {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 12px;
    transition: transform 0.15s ease;
}
.farasync-health-card.is-open .farasync-hc-chevron {
    transform: rotate(180deg);
}
.farasync-hc-recovery {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 10px 0 2px;
    padding: 8px 10px;
    font-size: 12.5px;
    color: #14532d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}
.farasync-hc-recovery .dashicons {
    color: #16a34a;
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}
.farasync-hc-errors-title,
.farasync-hc-fix-title {
    font-weight: 700;
    font-size: 12.5px;
    color: #475569;
    margin: 10px 0 5px;
}
.farasync-hc-errors {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.farasync-hc-errors li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 7px 9px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}
.farasync-hc-err-time {
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 700;
    color: #b91c1c;
    direction: ltr;
    unicode-bidi: embed;
}
.farasync-hc-err-type {
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 600;
    color: #7f1d1d;
    background: rgba(185, 28, 28, 0.09);
    border-radius: 4px;
    padding: 1px 6px;
    direction: ltr;
    unicode-bidi: embed;
}
.farasync-hc-err-msg {
    flex: 1 1 160px;
    min-width: 0;
    color: #7f1d1d;
    font-size: 12.5px;
    line-height: 1.7;
    word-break: break-word;
}
.farasync-hc-fix-text {
    margin: 0;
    color: #334155;
    font-size: 12.5px;
    line-height: 1.9;
}
.farasync-hc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.farasync-hc-act-sync,
.farasync-hc-act-logs {
    font-size: 12.5px !important;
    line-height: 2 !important;
    min-height: 30px;
    padding: 0 12px !important;
    border-radius: 6px !important;
}
.farasync-hc-act-sync:disabled {
    opacity: 0.65;
    cursor: default;
}
.farasync-hc-act-result {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 12.5px;
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
}
/* Healthy/unknown cards keep the quiet single-row look. */
.farasync-health-card.status-healthy .farasync-hc-head,
.farasync-health-card.status-unknown .farasync-hc-head {
    cursor: default;
}
@media (max-width: 600px) {
    .farasync-hc-errors li {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* v1.0.0: the command-center skin (loaded AFTER admin.css) re-lays the
   health card out as a flex row with 0-2-0 specificity — it must lose to
   the expandable structure, so these overrides carry the same specificity
   and the later position in THIS file. */
.farasync-command-center .farasync-health-card {
    display: block;
    min-height: 0;
    padding: 0;
    overflow: visible;
}
.farasync-command-center .farasync-health-card .farasync-health-dot {
    margin-top: 0;
}
.farasync-command-center .farasync-health-card .farasync-hc-head {
    padding: 12px 14px;
}
.farasync-command-center .farasync-health-card.status-healthy .farasync-hc-head,
.farasync-command-center .farasync-health-card.status-unknown .farasync-hc-head {
    cursor: default;
}

/* =====================================================================
   v1.0.0 — Source Health: clickable info tile + «خطاهای اخیر» MODAL.
   The card keeps the restored info row and the WHOLE CARD opens the
   errors dialog (the v1.0.0 inline expandable body is gone).
   ===================================================================== */
.farasync-health-card {
    cursor: pointer;
}
.farasync-health-card .farasync-hc-head {
    cursor: inherit;
}
.farasync-health-card.status-healthy .farasync-hc-head,
.farasync-health-card.status-unknown .farasync-hc-head {
    cursor: inherit;
}
/* v1.0.0: the info row became a grid of LABELED STAT TILES — icon + small
   gray label on TOP, bold value BELOW (the old same-line label/value pairs
   ran together and the user called the card «بهم ریخته»). auto-fit keeps
   desktop at 3 tracks, tablets at 2, phones at 1. */
.farasync-hc-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px dashed var(--farasync-border);
    font-size: 12.5px;
}
.farasync-hc-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 9px 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.farasync-hc-stat-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.5;
}
.farasync-hc-stat-lbl svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    color: #94a3b8;
}
.farasync-hc-stat-val {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* v1.0.0: the result box gets outcome tones (green «رفع شد» / red). */
.farasync-hc-act-result.ok {
    color: #14532d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.farasync-hc-act-result.err {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
/* v1.0.0: the calm «history» note on a green card (no recovery row). */
.farasync-hc-recovery.is-history {
    border-style: dashed;
    color: #166534;
}
/* Beginner-friendly summary line — replaces the old «سالم: ۰ | اخطار: ۱»
   badge row the user could not decode. */
.farasync-hc-summary {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 4px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.9;
}
.farasync-hc-sumdot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 7px;
}
.farasync-hc-summary.tone-ok {
    color: #14532d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.farasync-hc-summary.tone-ok .farasync-hc-sumdot {
    background: #22c55e;
}
.farasync-hc-summary.tone-warn {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.farasync-hc-summary.tone-warn .farasync-hc-sumdot {
    background: #f59e0b;
}
.farasync-hc-summary.tone-crit {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.farasync-hc-summary.tone-crit .farasync-hc-sumdot {
    background: #ef4444;
}
/* The type chip now carries a Persian LABEL («توقف ناگهانی پردازش»), not a
   slug — drop the old LTR forcing (the time chip keeps its own). */
.farasync-hc-err-type {
    direction: inherit;
    unicode-bidi: plaintext;
}
/* The errors modal: the same flex-scroll contract as the invoice popup —
   the h2 stays put, the BODY scrolls, footer pinned. */
#farasync-health-modal .farasync-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px);
    padding: 24px 28px 0;
    overflow: hidden;
}
#farasync-health-modal .farasync-modal-content h2 {
    flex: 0 0 auto;
    margin-bottom: 12px;
    font-size: 17px;
}
#farasync-health-modal .farasync-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-inline-end: 2px;
    padding-bottom: 16px;
}
@media (max-width: 600px) {
    #farasync-health-modal .farasync-modal-content {
        padding: 16px 16px 0;
    }
}

/* =====================================================================
   v1.0.0 — round 6 (items 5, 7, 9, 10)
   ===================================================================== */

/* ITEM 5 — the campaign icon in the plugin header (receive mode). Hidden
   unless at least one source runs an active campaign (the health AJAX
   toggles .is-on; the server prefills it from the cached transient). */
.farasync-camp-head-icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-inline-end: 6px;
    color: #7c3aed;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(124, 58, 237, .25);
    transition: transform .15s ease, box-shadow .15s ease;
}
.farasync-camp-head-icon.is-on {
    display: inline-flex;
}
.farasync-camp-head-icon:hover,
.farasync-camp-head-icon:focus {
    color: #6d28d9;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(124, 58, 237, .35);
    text-decoration: none;
    outline: none;
}

/* ITEM 9 — the nav count badges. Each tab carries its OWN number:
   «فاکتور نمایندگان» pending invoices, «رزروها» active reservations
   (source); «موارد ناموفق» failed items, «گزارش فروش» invoices awaiting
   payment (destination). Rendered only when the count is > 0. */
.farasync-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-inline-start: 6px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    background: #7c3aed;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
}
.farasync-tab[data-tab="invoices"] .farasync-tab-badge,
.farasync-tab[data-tab="reservations"] .farasync-tab-badge {
    background: #7c3aed;
}
.farasync-tab[data-tab="issues"] .farasync-tab-badge {
    background: #d63638;
}
.farasync-tab[data-tab="sales"] .farasync-tab-badge {
    background: #46b450;
}
.farasync-tab.is-active .farasync-tab-badge {
    color: #ffffff;
}

/* ITEM 7 — the inline tracking editor cell. */
.farasync-inv-col-track {
    white-space: nowrap;
}
.farasync-track-input {
    width: 100%;
    max-width: 170px;
    min-width: 110px;
    padding: 2px 8px;
    font-size: 12.5px;
    line-height: 1.9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.farasync-track-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, .18);
    outline: none;
}
.farasync-track-input.is-saving {
    opacity: .6;
    pointer-events: none;
}
.farasync-track-input.is-saved {
    border-color: #46b450;
    box-shadow: 0 0 0 2px rgba(70, 180, 80, .2);
}
.farasync-track-input.is-error {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, .18);
}
.farasync-tracking-import-btn.is-busy {
    opacity: .6;
}

/* ITEM 10 — the «کمپین در حال اجرا» pill must KEEP its rounded shape when
   clicked: wp-admin paints a square a:focus ring that clipped the pill's
   corners. The outline is replaced with a rounded box-shadow ring
   (keyboard focus stays visible via :focus-visible). */
.farasync-hc-campaign:focus,
.farasync-source-card .farasync-src-corner.is-start:focus {
    outline: none;
}
.farasync-hc-campaign:focus-visible,
.farasync-source-card .farasync-src-corner.is-start:focus-visible {
    outline: none;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, .45);
}
.farasync-source-card .farasync-src-corner.is-start:focus-visible {
    border-radius: 0 0 10px 10px;
}

/* ITEM 9 — the «خطاهای اخیر این مبدأ» modal: the copy breathes away from
   the edges and the re-sync button is wide + centered. */
#farasync-health-modal .farasync-modal-body {
    padding: 6px 22px 18px;
}
#farasync-health-modal .farasync-modal-body .farasync-hc-errors-title,
#farasync-health-modal .farasync-modal-body .farasync-hc-fix-title {
    margin-top: 14px;
}
#farasync-health-modal .farasync-hc-actions {
    justify-content: center;
    margin-top: 16px;
}
#farasync-health-modal .farasync-hc-act-sync {
    min-width: 240px;
    text-align: center;
    justify-content: center;
    padding: 0 18px !important;
}
@media (max-width: 600px) {
    #farasync-health-modal .farasync-modal-body {
        padding: 4px 14px 14px;
    }
    #farasync-health-modal .farasync-hc-act-sync {
        min-width: 0;
        width: 100%;
    }
}

/* v1.0.0 — the persistent currency notice (approved plan): a warning for
   unknown / non-convertible units, an info line while the automatic
   ریال↔تومان bridge is active. Sits above the health cards. */
.farasync-cur-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 13px;
    border-radius: 10px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.9;
    font-weight: 500;
}
.farasync-cur-banner .farasync-cur-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 7px;
    flex: 0 0 auto;
}
.farasync-cur-banner.is-warn {
    background: #fef3c7;
    color: #7c4a03;
    border: 1px solid #f2d38b;
}
.farasync-cur-banner.is-warn .farasync-cur-dot {
    background: #d97706;
}
.farasync-cur-banner.is-info {
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #b9e2f7;
}
.farasync-cur-banner.is-info .farasync-cur-dot {
    background: #0284c7;
}
@media (max-width: 600px) {
    .farasync-cur-banner {
        font-size: 12.5px;
        padding: 9px 11px;
    }
}

/* =====================================================================
   v1.0.0 — items 1/2/3/5/7/10
   ===================================================================== */

/* ITEMS 1+8 — the ONE currency-notice surface: BELOW the plugin header,
   between the header and the menu. X dismisses per user until the
   currency situation changes again (the key embeds the fingerprint). */
.farasync-cur-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.9;
    font-weight: 500;
}
.farasync-cur-notice .farasync-cur-notice-text {
    flex: 1 1 auto;
    margin: 0;
}
.farasync-cur-notice .farasync-cur-notice-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-top: 8px;
    border-radius: 50%;
}
.farasync-cur-notice .farasync-cur-notice-x {
    flex: 0 0 auto;
    margin: -2px -6px -2px 0;
    padding: 0 6px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 17px;
    line-height: 1.5;
    cursor: pointer;
    border-radius: 6px;
    opacity: 0.7;
}
.farasync-cur-notice .farasync-cur-notice-x:hover,
.farasync-cur-notice .farasync-cur-notice-x:focus {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}
.farasync-cur-notice.is-warn {
    background: #fef3c7;
    color: #7c4a03;
    border: 1px solid #f2d38b;
}
.farasync-cur-notice.is-warn .farasync-cur-notice-dot {
    background: #d97706;
}
.farasync-cur-notice.is-info {
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #b9e2f7;
}
.farasync-cur-notice.is-info .farasync-cur-notice-dot {
    background: #0284c7;
}

/* ITEM 2 — the bulk-print selection badge now floats on the TOP-LEFT
   corner of the print button (outside the button itself). */
.farasync-print-wrap {
    position: relative;
    display: inline-flex;
}
.farasync-print-wrap .farasync-print-count {
    position: absolute;
    top: -7px;
    left: -7px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    background: #e11d48;
    border: 2px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    pointer-events: none;
}

/* ITEM 5 — the delete icon buttons (group toolbar + per-row) of the
   sales report, and the row action cluster. */
.farasync-del-btn {
    color: #b32d2e !important;
}
.farasync-del-btn:hover,
.farasync-del-btn:focus {
    color: #ffffff !important;
    background: #b32d2e !important;
    border-color: #b32d2e !important;
}
.farasync-sales-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ITEM 10 — the guide text next to «بستن کمپین» (rewards tab). */
.farasync-rw-close-hint {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px dashed #f0c96b;
    border-radius: 8px;
}

/* ================================================================
   v1.0.0 (item 3, user request): the «روند فروش» KPI row — FOUR
   cards, always ONE row on desktop, each with its own color theme.
   The old 3 × .farasync-stat blocks wrapped onto two lines inside
   .farasync-modules-grid (min 360px per column) — that was the
   «کارت‌ها باید در یک ردیف باشند» report.
   ================================================================ */
.farasync-src-sales-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.farasync-kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* v1.0.0: keep the num/label spans symmetric for centered text */
    gap: 2px;
    padding: 14px 16px;
    border-radius: 14px;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 6px 16px -8px rgba(15, 23, 42, 0.35);
    min-height: 84px;
    text-align: center; /* v1.0.0 (user request): the four sales-trend KPI cards read centered */
}

.farasync-kpi-card .farasync-kpi-dot {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
}

.farasync-kpi-card .farasync-kpi-num {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    /* v1.0.0 (user request): the Toman unit must sit LEFT of the amount
       (Persian «۱۵۰٬۰۰۰ تومان»). The old forced LTR embed pushed the unit
       to the right of the digits. `plaintext` picks the paragraph
       direction from the content itself: fa strings render unit-left,
       en strings stay amount-left — one rule for both UI languages. */
    unicode-bidi: plaintext;
}

.farasync-kpi-card .farasync-kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.92;
    line-height: 1.5;
}

.farasync-kpi--blue {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}

.farasync-kpi--violet {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

.farasync-kpi--green {
    background: linear-gradient(135deg, #059669 0%, #34d399 100%);
}

.farasync-kpi--red {
    background: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
}

@media (max-width: 1280px) {
    .farasync-src-sales-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .farasync-src-sales-cards {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   v1.0.0 (user request): ONE icon-button size on EVERY page/modal.
   The command-center chrome (.farasync-command-center .button) forces
   min-height:38px + 7px/14px padding on every WP .button — the toolbar
   squares silently grew into 30×38 rectangles while the row squares
   (no .button class) stayed 30×30. This block is the single source of
   truth: every icon-only action square is exactly 30×30 with a 16px
   glyph, on every tab, every table row, every toolbar and every modal.
   The two old exceptions (26px imported-header sync, 34×33 rep CSV)
   are folded into the standard as well.
   ================================================================ */
button.farasync-icon-btn,
a.farasync-icon-btn,
.farasync-command-center button.farasync-icon-btn,
.farasync-command-center a.farasync-icon-btn,
.farasync-modal button.farasync-icon-btn,
.farasync-modal a.farasync-icon-btn,
.farasync-modal-content button.farasync-icon-btn,
.farasync-modal-content a.farasync-icon-btn,
button.farasync-print-btn:not(#farasync-x55),
a.farasync-print-btn:not(#farasync-x55),
.farasync-command-center button.farasync-print-btn:not(#farasync-x55),
.farasync-command-center a.farasync-print-btn:not(#farasync-x55),
.farasync-modal button.farasync-print-btn:not(#farasync-x55),
.farasync-modal a.farasync-print-btn:not(#farasync-x55),
.farasync-modal-content button.farasync-print-btn:not(#farasync-x55),
.farasync-modal-content a.farasync-print-btn:not(#farasync-x55),
.farasync-imported-actions-header button.farasync-icon-btn,
.farasync-imported-actions-header a.farasync-icon-btn,
.farasync-rep-csv-btn.farasync-icon-btn,
.farasync-rep-dashboard button.farasync-icon-btn,
.farasync-rep-dashboard a.farasync-icon-btn,
.farasync-action-dialog-close,
.farasync-rep-dashboard .farasync-print-btn:not(#farasync-x55),
#farasync-invoice-modal .farasync-print-btn:not(#farasync-x55),
.farasync-imported-sync-now {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    flex: 0 0 auto !important;
    line-height: 1 !important;
    border-radius: 7px !important;
}

/* the glyph follows the box — one size, no per-page drift */
button.farasync-icon-btn > svg,
a.farasync-icon-btn > svg,
.farasync-command-center button.farasync-icon-btn > svg,
.farasync-command-center a.farasync-icon-btn > svg,
.farasync-modal button.farasync-icon-btn > svg,
.farasync-modal a.farasync-icon-btn > svg,
button.farasync-print-btn:not(#farasync-x55) > svg,
a.farasync-print-btn:not(#farasync-x55) > svg,
.farasync-command-center .farasync-print-btn > svg,
.farasync-modal .farasync-print-btn > svg,
.farasync-imported-actions-header .farasync-icon-btn > svg,
.farasync-rep-dashboard .farasync-print-btn > svg,
#farasync-invoice-modal .farasync-print-btn > svg,
.farasync-action-dialog-close > svg,
.farasync-action-dialog-close svg {
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
    margin: 0 !important;
    display: block !important;
}

button.farasync-icon-btn .dashicons,
a.farasync-icon-btn .dashicons,
button.farasync-print-btn .dashicons,
a.farasync-print-btn .dashicons,
.farasync-imported-sync-now .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
}

/* ============================================================
   v1.0.0 (UI audit) — motion hygiene + tap targets + utilities
   ============================================================ */
/* v1.0.0: shared flex toolbar — replaces the copy-pasted inline flex
   styles on the filter rows so spacing tweaks happen in one place. */
.farasync-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
/* v1.0.0: semantic stat-tile color modifiers — replace the inline
   style="color:#…" escapes so all tiles share one styling regime. */
.farasync-stat--ok { color: #46b450; }
.farasync-stat--info { color: #007cba; }
.farasync-stat--warn { color: #dba617; }
.farasync-stat--bad { color: #d63638; }
.farasync-stat--muted { color: #94a3b8; }
/* v1.0.0: keyboard focus ring for visually-hidden chip inputs. */
.farasync-fchip-opt:focus-within {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
    border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
    .farasync-command-center *,
    .farasync-modal *,
    #farasync-toast-container *,
    .farasync-toast,
    .farasync-spin,
    .farasync-ord-spin,
    .farasync-warning-pulse,
    tr.farasync-row-flash {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
@media (max-width: 600px) {
    .farasync-icon-btn,
    .farasync-print-btn {
        width: 40px !important;
        height: 40px !important;
    }
    .farasync-chart-axis-txt {
        font-size: 9px; /* v1.0.0: 7px Persian digits were unreadable */
    }
}


/* ====================================================================
   v1.0.0 (user request) — «موارد ناموفق» gets TWO sub-tabs:
   «محصولات» (the existing failed-import list) and a NEW «سفارشات» list
   for orders whose push to the source failed. Same design tokens as the
   rest of the command center (WP palette vars + Vazirmatn stack).
   ==================================================================== */

/* ---- the sub-tab pill switcher ---- */
.farasync-issues-subtabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #ededee;
    border: 1px solid var(--farasync-border);
    border-radius: 999px;
    padding: 3px;
    margin: 0 0 14px;
    max-width: 100%;
}
.farasync-issues-subtab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 5px 16px;
    font-family: var(--farasync-font);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--farasync-text-muted);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.farasync-issues-subtab:hover {
    color: var(--farasync-text);
}
.farasync-issues-subtab:focus-visible {
    outline: 2px solid var(--farasync-primary);
    outline-offset: 1px;
}
.farasync-issues-subtab .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
    position: relative;
    top: -1px;
}
.farasync-issues-subtab.is-active {
    background: var(--farasync-surface);
    color: var(--farasync-text);
    font-weight: 700;
    box-shadow: var(--farasync-shadow-sm);
}
.farasync-issues-subtab-count {
    min-width: 19px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.7;
    border-radius: 999px;
    padding: 0 6px;
    background: #dcdcde;
    color: var(--farasync-text-muted);
}
.farasync-issues-subtab-count.is-hot {
    background: var(--farasync-danger-bg);
    color: var(--farasync-danger);
    border: 1px solid var(--farasync-danger-border);
}
.farasync-issues-subtab.is-active .farasync-issues-subtab-count.is-hot {
    background: var(--farasync-danger);
    color: #fff;
    border-color: var(--farasync-danger);
}
.farasync-issues-subtab.is-active .farasync-issues-subtab-count:not(.is-hot) {
    background: var(--farasync-primary-light);
    color: var(--farasync-primary);
}

/* ---- view switching ---- */
.farasync-issues-view {
    display: none;
}
.farasync-issues-view.is-active {
    display: block;
}

/* ---- «سفارشات» table ---- */
.farasync-ord-num {
    font-weight: 700;
    font-size: 13px;
    color: var(--farasync-primary);
    text-decoration: none;
}
.farasync-ord-num:hover {
    color: var(--farasync-primary-hover);
    text-decoration: underline;
}
.farasync-ord-meta {
    font-size: 11px;
    color: var(--farasync-text-muted);
    margin-top: 1px;
}
.farasync-ord-col-total {
    font-weight: 700;
    white-space: nowrap;
}
.farasync-ord-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.7;
    margin-bottom: 6px;
    white-space: nowrap;
}
.farasync-ord-chip .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}
.farasync-ord-chip.is-retrying {
    background: var(--farasync-primary-light);
    color: var(--farasync-primary);
    border: 1px solid #c5d9ed;
}
.farasync-ord-chip.is-failed {
    background: var(--farasync-danger-bg);
    color: var(--farasync-danger);
    border: 1px solid var(--farasync-danger-border);
}
.farasync-ord-why {
    font-size: 12px;
    line-height: 1.7;
    word-break: break-word;
    max-width: 340px;
}
.farasync-ord-row.is-retrying .farasync-ord-why {
    color: var(--farasync-text-muted);
}
.farasync-ord-row.is-failed .farasync-ord-why {
    color: var(--farasync-danger);
}
.farasync-ord-att {
    font-weight: 700;
    white-space: nowrap;
}
.farasync-ord-bar {
    display: block;
    width: 76px;
    height: 5px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin-top: 4px;
    direction: ltr;
}
.farasync-ord-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--farasync-primary);
}
.farasync-ord-bar.is-full i {
    background: var(--farasync-danger);
}
.farasync-ord-next {
    display: block;
    font-size: 10.5px;
    color: var(--farasync-text-muted);
    margin-top: 2px;
    white-space: nowrap;
}
.farasync-ord-next.is-urgent {
    color: var(--farasync-danger);
    font-weight: 700;
}
.farasync-ord-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.farasync-ord-retry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--farasync-border-strong);
    border-radius: var(--farasync-radius-sm);
    background: #f6f7f7;
    color: var(--farasync-text);
    font-family: var(--farasync-font);
    font-size: 12px;
    line-height: 1.7;
    padding: 2px 10px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.farasync-ord-retry .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}
.farasync-ord-retry:hover {
    background: #f0f0f1;
    border-color: var(--farasync-text-light);
}
.farasync-ord-retry.is-primary {
    background: var(--farasync-primary);
    border-color: var(--farasync-primary);
    color: #fff;
}
.farasync-ord-retry.is-primary:hover {
    background: var(--farasync-primary-hover);
    border-color: var(--farasync-primary-hover);
}
.farasync-ord-retry[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}
.farasync-ord-spin {
    animation: farasync-spin 0.8s linear infinite;
}
/* the × mirrors the products list glyph (bare, big, no button chrome) */
.farasync-ord-dismiss {
    appearance: none;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 2px !important;
    min-width: 32px !important;
    min-height: 36px !important;
    font-size: 32px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    vertical-align: middle;
    color: #b32d2e !important;
    cursor: pointer;
}
.farasync-ord-dismiss:hover {
    background: none !important;
    color: #7f1d1d !important;
    border: none !important;
    opacity: 0.85;
}
.farasync-ord-dismiss:focus {
    outline: 1px dotted #b32d2e;
    outline-offset: 2px;
}

/* small screens: the pills stretch, table columns stack like the rest */
@media (max-width: 782px) {
    .farasync-issues-subtabs {
        display: flex;
        width: 100%;
    }
    .farasync-issues-subtab {
        flex: 1;
        justify-content: center;
        padding: 6px 10px;
    }
    .farasync-ord-why {
        max-width: none;
    }
}

/* ==================================================================
   v1.0.0 — CREDIT: key-editor wallet controls + auto-paid badge
   ================================================================== */
.farasync-credit-current { margin: 0 0 8px; }
.farasync-credit-current strong { color: #2a9d76; font-size: 1.05em; }
.farasync-credit-adjust-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* v1.0.0 (user request): the amount field is DOUBLED in width — the old
   75px .small-text box could not fit «۱٬۰۰۰٬۰۰۰» comfortably. */
input.farasync-credit-amount-input {
    width: 180px;
    min-width: 180px;
}
#farasync-key-credit-reason { margin-top: 8px; }
.farasync-credit-recent { margin-top: 12px; }
/* v1.0.0 (user request): clicking one direction LOCKS the opposite
   button until the request settles — visually dimmed, no double fire. */
.farasync-credit-adjust.is-locked,
.farasync-credit-adjust:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.farasync-credit-recent h4 { margin: 0 0 6px; }
.farasync-credit-recent-table .farasync-credit-reason { opacity: .7; font-size: .9em; }
/* v1.0.0 (user request): the recent-activity statement is a COLLAPSIBLE —
   a clickable header (closed by default) revealing the table. The chevron
   flips when expanded; works in RTL and LTR alike (inline-start padding). */
.farasync-credit-recent-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 420px;
    margin: 0 0 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    cursor: pointer;
    text-align: start;
}
.farasync-credit-recent-toggle:hover { background: #f0f0f1; }
.farasync-credit-recent-toggle:focus { outline: 1px solid #4f46e5; outline-offset: 1px; }
.farasync-credit-recent-toggle .farasync-credit-recent-arrow::before {
    content: '\25B8'; /* ▸ — collapsed (points at the closed header) */
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    transition: transform .15s ease;
}
.farasync-credit-recent-toggle[aria-expanded="true"] .farasync-credit-recent-arrow::before {
    content: '\25BE'; /* ▾ — expanded */
}
.farasync-credit-recent-body { margin-top: 2px; }
.farasync-inv-autopaid {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #1e8e5a;
    background: #e7f7ef;
    border: 1px solid #bfe6d2;
    vertical-align: middle;
    white-space: nowrap;
}
/* v1.0.0: the standalone autopaid checkbox is gone (the filter moved
   INTO the status chip) — its label rule removed with it. */

/* ====================================================================
 * v1.0.0 (user request) — the invoices-tab ACTIONS cell, merged.
 *
 * The old layout spent two columns on it (a text «جزئیات فاکتور» button
 * + a narrow Print cell). Now ONE Actions cell holds three gray icon
 * buttons: [eye] [printer] [trash]. The freed width went to the تاریخ /
 * کد رهگیری / مجموع عمده‌فروشی columns (thead widths), and the
 * «شماره سفارش» header became «سفارش» on a narrower column.
 *  - white-space:nowrap + line-height:1 — the three 30px buttons stay
 *    on one line with no phantom baseline strut below them.
 *  - the shared gap is 4px (adjacent-sibling margin), applied to the
 *    cell's direct children so a missing print link never miscounts.
 *  - the plugin's own icon margins are zeroed inside this cell so the
 *    4px rhythm is exact (farasync-icon-btn ships margin:0 2px).
 * ==================================================================== */
.farasync-invoices-table td.farasync-inv-col-actions {
    white-space: nowrap;
    line-height: 1;
}
.farasync-invoices-table td.farasync-inv-col-actions > * {
    vertical-align: middle;
}
.farasync-invoices-table td.farasync-inv-col-actions .farasync-icon-btn,
.farasync-invoices-table td.farasync-inv-col-actions .farasync-print-btn {
    margin: 0 !important;
}
/* v1.0.0 (user report): the 5px gap NEVER rendered — this rule's old
   selector (0,2,1) LOST to the zeroing rule above (0,3,1, both !important),
   so all three buttons stayed glued together. Two repairs: the selector is
   bumped with .wp-list-table to (0,4,1) so it outranks the zeroing rule, and
   the gap is 4px (the user's 3-5px range — same rhythm the moneyflow tab
   uses since v1.0.0). inline-START keeps the gap BETWEEN siblings and the
   cluster edge flush in RTL and LTR alike. */
.wp-list-table.farasync-invoices-table td.farasync-inv-col-actions > * + * {
    margin-inline-start: 4px !important;
}

/* ====================================================================
 * v1.0.0/v1.0.0 (user request) — the invoices tab note indicator.
 * v1.0.0: the indicator is a FLOATING 12px badge pinned to the eye
 * button's START corner (the RIGHT side in the RTL admin — the user's
 * «سمت راست دکمه ی چشم»). The eye button sits inside a relative
 * .farasync-inv-view-wrap and the badge hangs off its start-top corner;
 * a soft drop-shadow keeps the glyph readable where it crosses the
 * button edge. Amber while unread, muted gray once read; hovering it
 * shows the native tooltip «حاوی یادداشت». It forwards clicks to the
 * eye's own .farasync-invoice-view handler, so the corner it covers is
 * never a dead zone. The 4px sibling gap rule above still spaces
 * [eye-wrap][print][trash] — the badge is absolute, outside the flow.
 * The old .farasync-note-badge rules stay — the invoice modal's inline
 * note pill still uses them.
 * ==================================================================== */
.farasync-inv-view-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.farasync-inv-note-ic {
    position: absolute;
    top: -5px;
    inset-inline-start: -5px; /* start side of the eye button = RIGHT in RTL */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    cursor: pointer;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.30));
}
.farasync-inv-note-ic svg {
    width: 12px;
    height: 12px;
    display: block;
}
.farasync-inv-note-ic.is-unread {
    color: #d97706;
}
.farasync-inv-note-ic.is-read {
    color: #94a3b8;
}
