/* FatouraPro Maroc — modern interaction layer.
   Loaded after erp.css. Screen controls only: printed documents keep their styles. */
@media screen {
  .erp-ui {
    --ui-primary: #3568e8;
    --ui-primary-dark: #2855ca;
    --ui-primary-soft: #eef3ff;
    --ui-control-ink: #40536e;
    --ui-control-border: #dce3ed;
    --ui-focus: #3568e8;
  }

  .erp-ui .ui-icon:not(:where(.invoice-document *, .ticket-document *)) {
    display: inline-block;
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    vertical-align: middle;
    overflow: visible;
    pointer-events: none;
  }
  .erp-ui .ui-button-label:not(:where(.invoice-document *, .ticket-document *)) {
    min-width: 0;
    color: inherit;
    font: inherit;
    line-height: 1.35;
    letter-spacing: inherit;
    pointer-events: none;
  }
  .erp-ui :is(button, a, input, select, textarea):focus-visible:not(:where(.invoice-document *, .ticket-document *)) {
    outline: 3px solid #3568e8;
    outline-offset: 3px;
  }
  .erp-ui .ui-modern-button:not(:where(.invoice-document *, .ticket-document *)) {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  }
  .erp-ui .erp-content .btn,
  .erp-ui .dialog > .actions .btn,
  .erp-ui .dialog form .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    max-width: 100%;
    padding: 10px 15px;
    border: 1px solid #2d5ed8;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(180deg, #3e73ef 0%, #3568e8 100%);
    box-shadow: 0 2px 3px #234ca00c, inset 0 1px 0 #ffffff20;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    filter: none;
  }
  .erp-ui .erp-page-title .btn,
  .erp-ui .pagehead .btn,
  .erp-ui .dialog > .actions .btn,
  .erp-ui .dialog form > .actions .btn {
    min-height: 42px;
    padding-inline: 16px;
    font-size: 12px;
  }
  .erp-ui .erp-content .btn.secondary,
  .erp-ui .dialog > .actions .btn.secondary,
  .erp-ui .dialog form .btn.secondary {
    border-color: var(--ui-control-border);
    color: var(--ui-control-ink);
    background: #fff;
    box-shadow: 0 1px 2px #233e5e06;
  }
  .erp-ui .erp-content .btn:hover,
  .erp-ui .dialog .btn:hover {
    filter: none;
  }
  .erp-ui .erp-content .actions,
  .erp-ui .dialog .actions,
  .erp-ui .erp-actions-bar {
    gap: 9px;
  }
  .erp-ui .dialog > .cardtitle .close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 36px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #f6f8fb;
    color: #6b7c93;
  }
  .erp-ui .ui-icon-only:not(:where(.invoice-document *, .ticket-document *)),
  .erp-ui .erp-card-back > div button,
  .erp-ui .erp-pagination > div button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid var(--ui-control-border);
    border-radius: 9px;
    background: #fff;
    color: #627793;
    box-shadow: 0 1px 2px #233e5e05;
    text-decoration: none;
  }
  .erp-ui .erp-table .ui-icon-only {
    width: 34px;
    height: 34px;
    color: #617c9f;
    background: #f7f9fc;
    border-color: #e5eaf2;
  }
  .erp-ui .dialog .lineform .ui-icon-only {
    width: 30px;
    height: 38px;
    min-height: 38px;
    align-self: center;
    color: #a25e67;
    background: #fff8f8;
    border-color: #f1dee2;
  }
  .erp-ui .erp-pagination > div button.active {
    color: #fff;
    border-color: var(--ui-primary);
    background: var(--ui-primary);
  }
  .erp-ui .erp-content .link:not(.ui-icon-only),
  .erp-ui .erp-content .erp-ref:not(.ui-icon-only) {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-height: 28px;
    max-width: 100%;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
  }
  .erp-ui .erp-content .erp-ref .ui-icon { width: 15px; height: 15px; }
  .erp-ui .erp-content .grid, .erp-ui .erp-content .grid > *, .erp-ui .erp-content .chart, .erp-ui .erp-content .bars { min-width: 0; }
  .erp-ui .erp-content .tablewrap { max-width: 100%; }
  .erp-ui .erp-content .tablecard .link { white-space: nowrap; }
  .erp-ui .erp-card-back > .link { padding: 6px 8px; margin-inline-start: -8px; }
  .erp-ui .erp-sort .ui-icon { width: 12px; height: 12px; }

  /* Top modules retain the compact ERP header geometry. */
  .erp-ui .erp-modules { padding-inline: 5px; scrollbar-width: none; }
  .erp-ui .erp-modules::-webkit-scrollbar { display: none; }
  .erp-ui .erp-modules button {
    position: relative;
    justify-content: center;
    gap: 4px;
    margin: 5px 2px;
    padding: 5px 12px 6px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #d4dfed;
    background: transparent;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 11px;
    font-weight: 500;
  }
  .erp-ui .erp-modules button > .ui-icon,
  .erp-ui .erp-modules button .icon > .ui-icon {
    width: 21px;
    height: 21px;
    color: #c9d9ef;
  }
  .erp-ui .erp-modules button.active {
    color: #fff;
    background: #ffffff13;
    border-color: #ffffff18;
    font-weight: 600;
    box-shadow: inset 0 1px 0 #ffffff07;
  }
  .erp-ui .erp-modules button.active::after {
    position: absolute;
    content: "";
    bottom: 3px;
    inset-inline: calc(50% - 9px);
    height: 2px;
    border-radius: 3px;
    background: #99bcff;
  }
  .erp-ui .erp-modules button.active > .ui-icon { color: #fff; }
  .erp-ui .erp-modules button .ui-button-label { padding: 0; margin: 0; color: inherit; }
  .erp-ui .erp-account button.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 33px;
    border-radius: 8px;
    padding-inline: 9px;
    border-color: #ffffff25;
    background: #ffffff0b;
    font-weight: 500;
  }
  .erp-ui .erp-account button.pill .ui-icon { width: 15px; height: 15px; }
  .erp-ui .erp-account button.ui-icon-only { color: #e4edfc; border-color: #ffffff33; background: #ffffff0b; box-shadow: none; }

  .erp-ui .erp-subnav { padding-inline: 10px; }
  .erp-ui .erp-subnav button {
    position: relative;
    gap: 10px;
    min-height: 39px;
    margin-block: 4px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #5b6b80;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
  }
  .erp-ui .erp-subnav button > .ui-icon,
  .erp-ui .erp-subnav button .icon > .ui-icon { width: 17px; height: 17px; color: #8393aa; }
  .erp-ui .erp-subnav button > .ui-button-label {
    margin: 0;
    padding: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    font: inherit;
  }
  .erp-ui .erp-subnav button.active {
    color: #2855b5;
    border-color: #d5e1fb;
    background: #e7eefc;
    font-weight: 600;
    box-shadow: 0 1px 2px #2d5cca04;
  }
  .erp-ui .erp-subnav button.active > .ui-icon { color: #3568df; }
  .erp-ui .erp-subnav button .erp-tab-count {
    margin-inline-start: auto;
    border-radius: 6px;
    background: #e5eaf2;
    color: #798ca5;
    font-size: 10px;
    font-weight: 600;
  }
  .erp-ui .erp-subnav button.active .erp-tab-count { background: #d9e5ff; color: #3568cf; }
  .erp-ui .erp-sidebottom button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    border-radius: 7px;
    line-height: 1.4;
  }
  .erp-ui .erp-sidebottom .trial button { margin-top: 6px; color: #315fc4; }
  .erp-ui .erp-sidebottom > button { padding-inline: 6px; margin-inline-start: -6px; }
  .erp-ui .erp-sidebottom { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
  .erp-ui .erp-sidebottom > .badge { align-self: flex-start; }
  .erp-ui .erp-sidebottom > button { width: 100%; justify-content: flex-start; }
  .erp-ui .erp-sidebottom .ui-icon { width: 15px; height: 15px; }

  .erp-ui .erp-tabs { gap: 4px; padding: 4px 5px 0; }
  .erp-ui .erp-tabs button {
    gap: 7px;
    min-height: 42px;
    border-bottom-width: 2px;
    border-radius: 8px 8px 0 0;
    color: #6d7f96;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
  }
  .erp-ui .erp-tabs button.active {
    color: #2f5fcc;
    background: #eef3ff;
    border-bottom-color: #3568e8;
    font-weight: 600;
  }
  .erp-ui .erp-tabs button.active .erp-tab-count { background: #dfe8ff; color: #3c63bd; }
  .erp-ui .erp-tabs .erp-tab-count { border-radius: 5px; }

  /* Quick actions have independent spacing from regular inline buttons. */
  .erp-ui .erp-content .quick { gap: 12px; }
  .erp-ui .erp-content .quick button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    min-height: 109px;
    padding: 15px;
    border: 1px solid #e0e6ef;
    border-radius: 12px;
    background: linear-gradient(150deg, #fff, #fbfcff);
    color: #465c7b;
    box-shadow: 0 1px 2px #233e5e04;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: start;
  }
  .erp-ui .erp-content .quick button > .ui-icon {
    width: 37px;
    height: 37px;
    padding: 9px;
    color: #3568d3;
    background: #edf2ff;
    border-radius: 11px;
    margin: 0;
  }
  .erp-ui .erp-content .quick button:nth-child(2) > .ui-icon { color: #2a8979; background: #eaf6f1; }
  .erp-ui .erp-content .quick button:nth-child(3) > .ui-icon { color: #8960c1; background: #f2edfb; }
  .erp-ui .erp-content .quick button:nth-child(4) > .ui-icon { color: #b77b38; background: #fcf3e7; }
  .erp-ui .erp-content .quick button > .ui-button-label { margin: 0; color: inherit; font: inherit; }
  .erp-ui .erp-content .banner > button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #d6e1f2;
    border-radius: 8px;
    background: #ffffffa6;
    color: #456796;
    font-weight: 600;
  }
  .erp-ui .erp-title-icon .ui-icon { width: 22px; height: 22px; }
  .erp-ui .erp-object-icon .ui-icon { width: 29px; height: 29px; }
  .erp-ui .erp-title-icon { border-radius: 10px; }
  .erp-ui .erp-object-icon { border-radius: 12px; }
  .erp-ui .erp-breadcrumb button { display: inline-flex; align-items: center; gap: 5px; }
  .erp-ui .erp-breadcrumb .ui-icon { width: 13px; height: 13px; }

  /* Disabled controls stay visibly unavailable and never mimic a loading state. */
  .erp-ui .ui-modern-button:disabled:not(:where(.invoice-document *, .ticket-document *)),
  .erp-ui .erp-content .btn:disabled,
  .erp-ui .dialog .btn:disabled,
  .erp-ui .erp-card-back > div button:disabled,
  .erp-ui .erp-pagination > div button:disabled {
    opacity: 1;
    color: #a3afbf;
    background: #f0f3f7;
    border-color: #e1e6ed;
    box-shadow: none;
    cursor: not-allowed;
    filter: none;
    transform: none;
  }
  .erp-ui.rtl .ui-directional:not(:where(.invoice-document *, .ticket-document *)) { transform: scaleX(-1); }

  @media (hover: hover) and (pointer: fine) {
    .erp-ui .erp-content .btn:not(:disabled):hover,
    .erp-ui .dialog > .actions .btn:not(:disabled):hover,
    .erp-ui .dialog form .btn:not(:disabled):hover {
      transform: translateY(-1px);
      border-color: #2454cd;
      background: linear-gradient(180deg, #3569e8, #2e5ed8);
      box-shadow: 0 4px 9px #2b57bd26, inset 0 1px 0 #ffffff15;
    }
    .erp-ui .erp-content .btn.secondary:not(:disabled):hover,
    .erp-ui .dialog > .actions .btn.secondary:not(:disabled):hover,
    .erp-ui .dialog form .btn.secondary:not(:disabled):hover {
      background: #f7f9ff;
      border-color: #bdcfee;
      color: #315bb5;
      box-shadow: 0 3px 7px #234ca00c;
    }
    .erp-ui .ui-icon-only:not(:disabled):hover,
    .erp-ui .erp-card-back > div button:not(:disabled):hover,
    .erp-ui .erp-pagination > div button:not(:disabled):hover {
      color: #315fc6;
      border-color: #c4d5f5;
      background: #eef3ff;
      box-shadow: 0 2px 5px #315fc60d;
    }
    .erp-ui .dialog .lineform .ui-icon-only:not(:disabled):hover { background: #fbecef; border-color: #e8bfc7; color: #a14f5a; }
    .erp-ui .erp-content .link:not(.ui-icon-only):hover,
    .erp-ui .erp-content .erp-ref:not(.ui-icon-only):hover { color: #2457c8; text-decoration: underline; text-underline-offset: 3px; }
    .erp-ui .erp-modules button:not(.active):hover { background: #ffffff0d; border-color: #ffffff0d; color: #fff; }
    .erp-ui .erp-account button.pill:hover { background: #ffffff19; border-color: #ffffff40; }
    .erp-ui .erp-subnav button:not(.active):hover { background: #e8edf5; color: #344f76; border-color: #e1e8f2; }
    .erp-ui .erp-tabs button:not(.active):hover { background: #e9effb; color: #466aa8; }
    .erp-ui .erp-sidebottom button:hover { color: #315fc6; background: #e7eef9; }
    .erp-ui .erp-content .quick button:not(:disabled):hover { transform: translateY(-2px); background: #f7faff; border-color: #bfd1f0; box-shadow: 0 5px 12px #315b9e0f; }
    .erp-ui .erp-content .banner > button:hover { color: #315fc6; background: #fff; border-color: #b7cae8; }
  }
  .erp-ui .ui-modern-button:not(:disabled):active:not(:where(.invoice-document *, .ticket-document *)) {
    transform: none;
    box-shadow: none;
  }

  @media (max-width: 1200px) {
    .erp-ui .erp-modules button { padding-inline: 9px; }
  }
  @media (max-width: 1000px) {
    .erp-ui .erp-modules button { padding-inline: 7px; min-width: 64px; font-size: 10px; }
  }
  @media (max-width: 760px) {
    .erp-ui .erp-content .bars { gap: 10px; padding-inline: 5px; }
    .erp-ui .erp-content .tablecard table { min-width: 640px; }
    .erp-ui .erp-modules { height: 61px; padding-inline: 4px; }
    .erp-ui .erp-modules button { flex: 1 0 71px; min-width: 71px; margin-block: 4px; padding-inline: 8px; gap: 3px; font-size: 10px; }
    .erp-ui .erp-modules button > .ui-icon { width: 20px; height: 20px; }
    .erp-ui .erp-account { gap: 7px; padding-inline: 10px; }
    .erp-ui .erp-account button.pill { min-height: 31px; padding-inline: 7px; gap: 5px; }
    .erp-ui .erp-account button.pill .ui-icon { width: 14px; height: 14px; }
    .erp-ui .erp-content .btn,
    .erp-ui .dialog > .actions .btn,
    .erp-ui .dialog form .btn { min-height: 42px; padding-inline: 12px; font-size: 12px; gap: 7px; }
    .erp-ui .erp-page-title .actions,
    .erp-ui .erp-content .pagehead .actions { flex-wrap: wrap; width: 100%; }
    .erp-ui .erp-content .quick { gap: 10px; }
    .erp-ui .erp-content .quick button { padding: 13px; min-height: 111px; font-size: 11px; }
    .erp-ui .erp-content .quick button > .ui-icon { width: 36px; height: 36px; }
    .erp-ui .erp-pagination { row-gap: 10px; }
    .erp-ui .erp-pagination > div { flex-wrap: wrap; }
    .erp-ui .erp-card-back { gap: 8px; }
    .erp-ui .erp-card-back > div { gap: 7px; flex: 0 0 auto; }
    .erp-ui .erp-tabs button { padding-inline: 12px; font-size: 11px; }
    .erp-ui .erp-content .banner > button { max-width: 100%; white-space: normal; text-align: start; }
    .erp-ui .erp-content .banner > button .ui-button-label { overflow-wrap: anywhere; }
  }
  @media (prefers-reduced-motion: reduce) {
    .erp-ui .ui-modern-button:not(:where(.invoice-document *, .ticket-document *)),
    .erp-ui .erp-modules button { transition: none; }
    .erp-ui .ui-modern-button:not(:disabled):hover:not(:where(.invoice-document *, .ticket-document *)) { transform: none; }
  }
}
