/* Almufsal Forms. Colours follow the site: gold #BE9658 with navy text #141A33.
   Surfaces use translucent greys so the same rules work in the dark (default) and light modes. */
.mff, .mff-fab, .mff-toast, table.mf-items, .mff-tsearch, .mff-tempty, .mff-cnt {
  --mff-gold: #BE9658;
  --mff-on-gold: #141A33;
  --mff-line: rgba(140, 146, 170, .35);
  --mff-soft: rgba(140, 146, 170, .10);
  --mff-bad: #D9534F;
  --mff-ok: #3FA373;
}
.mff { margin: 1.5rem 0; font-size: 15px; line-height: 1.7; }
.mff *, .mff *::before, .mff *::after { box-sizing: border-box; }
.mff h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.mff-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mff-main, .mff-side { display: grid; gap: 16px; min-width: 0; }
.mff-box { border: 1px solid var(--mff-line); border-radius: 12px; padding: 18px; display: grid; gap: 12px; background: var(--mff-soft); }
.mff-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mff-f { display: grid; gap: 4px; font-size: .9rem; }
.mff-f > span { opacity: .9; }
.mff input[type="text"], .mff input[type="email"], .mff input[type="tel"], .mff input[type="number"], .mff input[type="search"], .mff select, .mff textarea {
  width: 100%; border: 1px solid var(--mff-line); background: transparent; color: inherit;
  border-radius: 8px; padding: 9px 11px; font: inherit; font-size: .95rem;
}
.mff select option { color: #141A33; }
.mff input:focus, .mff select:focus, .mff textarea:focus { outline: 2px solid var(--mff-gold); outline-offset: 1px; }
.mff .mff-bad { border-color: var(--mff-bad) !important; }
.mff-muted { opacity: .75; }
.mff-small { font-size: .8rem; margin: 0; }
.mff-link { color: var(--mff-gold); font-weight: 600; text-decoration: none; justify-self: start; }
.mff-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--mff-gold); text-decoration: none; }
.mff-gold { background: var(--mff-gold); color: var(--mff-on-gold); }
.mff-gold:disabled { opacity: .6; cursor: wait; }
.mff-line { background: transparent; color: var(--mff-gold); }
.mff-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mff-rc { min-height: 78px; }
.mff, .mff h3, .mff label, .mff p { text-align: start; }
.mff .mff-done, .mff-drop { text-align: center; }

/* files */
.mff-drop { border: 1.5px dashed var(--mff-line); border-radius: 10px; padding: 14px; text-align: center; display: grid; gap: 6px; justify-items: center; font-size: .88rem; }
.mff-drop span { opacity: .8; }
.mff-drop.over { border-color: var(--mff-gold); background: var(--mff-soft); }
.mff-drop input[type="file"] { display: none; }
.mff-drop .mff-btn { padding: 6px 14px; }
.mff-files { display: grid; gap: 6px; }
.mff-file { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--mff-soft); border-radius: 8px; padding: 6px 10px; font-size: .85rem; }
.mff-fn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mff-err { color: var(--mff-bad); font-size: .85rem; min-height: 0; }
.mff-err:empty { display: none; }
.mff-err-box { border: 1px solid var(--mff-bad); border-radius: 10px; padding: 10px 14px; margin: 1rem 0; }

/* search */
.mff-search { position: relative; }
.mff-results { position: absolute; z-index: 30; inset-inline: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none;
  background: #141A33; color: #EEF0F5; border: 1px solid var(--mff-line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); max-height: 320px; overflow: auto; }
.mff-res { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: grid; gap: 2px; }
.mff-res small { opacity: .75; }
.mff-res:hover, .mff-res.on { background: rgba(190, 150, 88, .22); }
.mff-res-note { padding: 8px 10px; opacity: .8; font-size: .88rem; }
.mff-results[hidden], .mff-results:empty { display: none !important; }
.mff-fields { display: grid; grid-template-columns: 110px 150px; gap: 8px; }
.mff-mini { display: grid; gap: 2px; font-size: .78rem; }
.mff-mini span { opacity: .75; }
.mff .mff-mini input { padding: 6px 8px; font-size: .88rem; }
.mff-check { display: flex; gap: 8px; align-items: center; font-size: .88rem; cursor: pointer; }
.mff-check input { width: 18px; height: 18px; accent-color: var(--mff-gold); }

/* basket rows */
.mff-rows { display: grid; gap: 10px; }
.mff-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--mff-line); padding-bottom: 10px; }
.mff-nm { min-width: 0; display: grid; }
.mff-nm small { opacity: .7; text-align: start; }
.mff-qty { display: flex; align-items: center; border: 1px solid var(--mff-line); border-radius: 8px; }
.mff-qty button { border: 0; background: transparent; color: inherit; width: 30px; height: 32px; cursor: pointer; font-size: 1rem; }
.mff .mff-qty input { width: 56px; border: 0; padding: 4px; text-align: center; -moz-appearance: textfield; }
.mff-qty input::-webkit-outer-spin-button, .mff-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mff-rm { border: 0; background: transparent; color: var(--mff-bad); cursor: pointer; font: inherit; font-size: .85rem; }

/* side */
.mff-count { font-size: 1.1rem; font-weight: 700; margin: 0; }
.mff-trust { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.mff-trust li::before { content: "✓ "; color: var(--mff-ok); }
.mff-how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mff-how li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; font-size: .9rem; }
.mff-how b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--mff-soft); color: var(--mff-gold); }
.mff-how small { display: block; opacity: .75; }

/* done */
.mff-done { border: 1px solid var(--mff-gold); border-radius: 12px; padding: 22px; display: grid; gap: 6px; justify-items: start; margin: 1rem 0; }
.mff-done p { margin: 0; }
.mff-ref { font-size: 1.5rem; font-weight: 700; color: var(--mff-gold); }

/* catalogue tables */
table.mf-items .mff-col { white-space: nowrap; text-align: center; }
table.mf-items .mff-size { display: block; margin: 0 auto 6px; max-width: 170px; border: 1px solid var(--mff-line); background: transparent; color: inherit; border-radius: 6px; padding: 3px 6px; font: inherit; font-size: .8rem; }
table.mf-items .mff-size option { color: #141A33; }
.mff-add { border: 1px solid var(--mff-gold); background: transparent; color: var(--mff-gold); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: .82rem; cursor: pointer; }
.mff-add.in { background: var(--mff-gold); color: var(--mff-on-gold); }
.mff-add:focus-visible { outline: 2px solid var(--mff-gold); outline-offset: 2px; }

/* category pages: search bar, counts */
.mff-tsearch { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.mff-tsearch input[type="text"] { flex: 1; min-width: 200px; border: 1px solid var(--mff-line) !important; background: transparent !important; color: inherit; border-radius: 10px !important; padding: 9px 12px; font: inherit; }
.mff-tsearch input:focus { outline: 2px solid var(--mff-gold); outline-offset: 1px; }
.mff-tcount { font-size: .88rem; opacity: .8; white-space: nowrap; }
.mff-tempty { text-align: center; opacity: .8; margin: 10px 0; }
table.mf-items tr[hidden] { display: none !important; }
.mff-cnt { display: inline-block; margin-inline-start: 8px; font-size: .78rem; font-weight: 600; background: rgba(190, 150, 88, .18); color: var(--mff-gold); border-radius: 999px; padding: 1px 9px; vertical-align: middle; }

/* catalogue tables as cards on phones */
@media (max-width: 640px) {
  table.mf-items thead { display: none; }
  table.mf-items, table.mf-items tbody { display: block; width: 100%; }
  table.mf-items tbody tr { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-items: start;
    border: 1px solid var(--mff-line) !important; border-radius: 12px; padding: 10px; margin: 0 0 10px; }
  table.mf-items tbody td { display: block; border: 0 !important; padding: 0 !important; text-align: start !important; background: none !important; }
  table.mf-items tbody td.mf-img { grid-row: 1 / span 4; }
  table.mf-items tbody td.mf-img img { width: 72px; height: 72px; border-radius: 8px; }
  table.mf-items tbody td:nth-child(2) { font-size: .8rem; opacity: .75; order: 2; }
  table.mf-items tbody td:nth-child(3) { font-weight: 700; order: 1; }
  table.mf-items tbody td:nth-child(4) { font-size: .85rem; opacity: .85; order: 3; }
  table.mf-items tbody td:nth-child(4):empty, table.mf-items tbody td:nth-child(4):only-child { display: none; }
  table.mf-items tbody td.mff-col { order: 4; text-align: start; margin-top: 6px; }
  table.mf-items .mff-size { margin: 0 0 6px; }
  table.mf-items .mf-l { display: inline-block; margin-inline-end: 10px; }
}

/* home: product portfolio + sectors (line-art cards) */
.mfh { --mff-gold: #BE9658; --mff-line: rgba(140, 146, 170, .35); --mff-soft: rgba(140, 146, 170, .08); }
#mf-sectors { padding: 80px 0; }
.mfh .mfh-lead { max-width: 760px; margin: 6px 0 26px; opacity: .8; line-height: 1.8; }
.mfh-grid { display: grid; gap: 16px; }
.mfh-g5 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.mfh-g4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mfh-card, .mfh-sec { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--mff-line); border-radius: 14px; padding: 20px; background: var(--mff-soft); color: inherit !important; text-decoration: none !important; text-align: start; transition: border-color .2s, transform .2s, background .2s; }
.mfh-card:hover, .mfh-card:focus-visible { border-color: var(--mff-gold); transform: translateY(-3px); background: rgba(190, 150, 88, .08); }
.mfh-card:focus-visible { outline: 2px solid var(--mff-gold); outline-offset: 2px; }
.mfh-ic { width: 56px; height: 56px; color: rgba(140, 146, 170, .9); transition: color .2s; }
.mfh-ic svg { width: 100%; height: 100%; }
.mfh-card:hover .mfh-ic, .mfh-card:focus-visible .mfh-ic, .mfh-sec .mfh-ic { color: var(--mff-gold); }
.mfh-t { font-weight: 700; font-size: 1.05rem; line-height: 1.4; }
.mfh-n { align-self: flex-start; font-size: .78rem; font-weight: 700; color: var(--mff-gold); background: rgba(190, 150, 88, .15); border-radius: 999px; padding: 2px 10px; }
.mfh-card ul { list-style: none; margin: 2px 0 6px; padding: 0; display: grid; gap: 3px; font-size: .86rem; opacity: .78; }
.mfh-card ul li { margin: 0; padding: 0; background: none; }
.mfh-card ul li::before { content: "• "; color: var(--mff-gold); }
.mfh-go { margin-top: auto; font-size: .88rem; font-weight: 600; color: var(--mff-gold); }
.mfh-sec { flex-direction: row; align-items: flex-start; gap: 14px; }
.mfh-sec .mfh-ic { width: 44px; height: 44px; flex: none; }
.mfh-sec .mfh-t { display: block; font-size: .98rem; }
.mfh-sec .mfh-d { display: block; font-size: .84rem; opacity: .75; margin-top: 2px; }
.mfh-sec > span:not(.mfh-ic) { min-width: 0; }
.mfh-sec { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; }
.mfh-sec .mfh-ic { grid-row: 1 / span 2; }
@media (max-width: 640px) { #mf-sectors { padding: 50px 0; } .mfh-card, .mfh-sec { padding: 16px; } }
/* light mode: darker gold so small gold text keeps 4.5:1 contrast */
html:has(link[title="background"]:not([disabled])) .mfh { --mff-gold: #87672C; }
@media (prefers-reduced-motion: reduce) { .mfh-card, .mfh-ic { transition: none; } .mfh-card:hover { transform: none; } }

/* floating button + toast */
.mff-fab { position: fixed; z-index: 9990; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 18px;
  display: flex; align-items: center; gap: 8px; background: var(--mff-gold); color: var(--mff-on-gold) !important;
  border-radius: 999px; padding: 10px 16px; font-weight: 700; text-decoration: none !important; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.mff-fab .mff-n { background: var(--mff-on-gold); color: var(--mff-gold); border-radius: 999px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: .8rem; padding: 0 6px; }
.mff-fab[hidden] { display: none; }
.mff-toast { position: fixed; z-index: 9991; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px);
  background: #141A33; color: #EEF0F5; border-radius: 999px; padding: 9px 18px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
.mff-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .mff-grid, .mff-two { grid-template-columns: 1fr; }
  .mff-row { grid-template-columns: 1fr auto; }
  .mff-row .mff-fields { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .mff-row .mff-rm { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .mff-toast { transition: none; } }
