/* Fly quotes — shared styles. Mobile first, RTL, touch targets ≥ 44px. */
:root {
  --navy: #282460;
  --navy-dark: #1C1947;
  --cyan: #1FA3D6;
  --action: #1B7FB0;
  --ink: #1B1B2A;
  --muted: #5A5F73;
  --line: #D5DAE8;
  --bg: #F5F6FB;
  --tint: #E6F4FB;
  --tint-ink: #0B4F70;
  --ok-bg: #E6F6EC; --ok-ink: #11683A;
  --err-bg: #FDECEC; --err-ink: #A11D1D;
  --warn-bg: #FFF4E5; --warn-ink: #8A4B08;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 15px/1.6 "IBM Plex Sans Arabic", Tahoma, system-ui, sans-serif; }
a { color: var(--navy); }
a:hover { color: var(--cyan); }
h1, h2, h3 { font-family: "Noto Kufi Arabic", "IBM Plex Sans Arabic", sans-serif; color: var(--navy); line-height: 1.4; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; unicode-bidi: isolate; }
.muted { color: var(--muted); font-size: 13px; }

/* Header: menu button + user on the right (RTL start), white logo on the left (end) */
:root { --top-h: 64px; --side-w: 250px; }
.top { background: var(--navy); color: #fff; height: var(--top-h); padding: 0 12px; position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px; }
.menu-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.menu-btn:hover { background: rgba(255,255,255,.1); }
.who { display: flex; flex-direction: column; font-size: 12px; color: #C9CCE6; line-height: 1.3; min-width: 0; }
.who b { color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { margin-inline-start: auto; display: flex; align-items: center; flex: none; }
.brand img { height: 40px; width: auto; display: block; }
@media (max-width: 380px) { .brand img { height: 32px; } }

/* Side menu: drawer on phones, fixed column on wide screens */
.side { position: fixed; top: var(--top-h); bottom: 0; inset-inline-start: 0; width: var(--side-w); max-width: 85vw;
  background: #fff; border-inline-end: 1px solid var(--line); z-index: 25; overflow-y: auto;
  transform: translateX(100%); transition: transform .2s ease; padding: 12px 10px; }
.side.open { transform: none; box-shadow: -8px 0 24px rgba(27,27,42,.15); }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(27,27,42,.35); z-index: 20; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font: inherit; font-size: 15px; border: 0; background: none; cursor: pointer; text-align: start; }
.side-link .ico { color: var(--muted); flex: none; }
.side-link:hover { background: var(--bg); color: var(--navy); }
.side-link.on { background: var(--tint); color: var(--tint-ink); font-weight: 600; }
.side-link.on .ico { color: var(--action); }
.side-link.soon { color: #9A9EAF; cursor: default; }
.side-link.soon:hover { background: none; color: #9A9EAF; }
.side-link.soon .ico { color: #C3C7D4; }
.side-link small { margin-inline-start: auto; font-size: 11px; background: var(--bg); border-radius: 99px; padding: 0 8px; }
.side-logout { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.side-logout .side-link { color: var(--err-ink); }
.side-logout .side-link .ico { color: var(--err-ink); }
@media (min-width: 900px) {
  :root { --top-h: 88px; --side-w: 270px; }
  .top { padding: 0 28px; gap: 14px; }
  .brand img { height: 60px; }
  .who { font-size: 14px; line-height: 1.4; }
  .who b { font-size: 18px; }
  .side-link { font-size: 16px; min-height: 52px; }
  .menu-btn { display: none; }
  .side { transform: none; box-shadow: none; }
  .scrim { display: none; }
  body.has-side .page { margin-inline-start: var(--side-w); }
  body.has-side .page { max-width: none; padding-inline: 32px; }
  body.has-side .page > * { max-width: 760px; }
}

/* Page */
.page { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  padding: 0 12px; font: inherit; font-size: 15px; color: var(--ink); }
textarea { padding: 10px 12px; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan); }
.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.hint { font-size: 12px; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font: inherit;
  font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; background: var(--navy-dark); }
.btn-block { width: 100%; }
.btn-outline { background: #fff; color: var(--navy); }
.btn-outline:hover { background: var(--tint); color: var(--navy); }
.btn-small { min-height: 44px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn-danger { background: #fff; color: var(--err-ink); border-color: #E7B4B4; }
.btn-danger:hover { background: var(--err-bg); color: var(--err-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Messages */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }

/* Badges & lists */
.badge { display: inline-block; font-size: 12px; border-radius: 99px; padding: 1px 10px; background: var(--bg); color: var(--navy); }
.badge-admin { background: var(--navy); color: #fff; }
.badge-off { background: var(--warn-bg); color: var(--warn-ink); }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.list-item { border-top: 1px solid var(--line); padding: 12px 0; }
.list-item:first-child { border-top: 0; padding-top: 0; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--navy); font-weight: 600; }

.delete-user { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.delete-user label { width: 100%; margin-bottom: 4px; }

/* Quote list */
.filters { display: flex; gap: 8px; margin-bottom: 10px; }
.filters input { flex: 1; }
.filters select { width: auto; max-width: 45%; }
.chips-row { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.fchip { flex: none; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: 13px; }
.fchip b { font-weight: 600; color: var(--muted); }
.fchip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.fchip.on b { color: #C9CCE6; }
.quote-item { padding: 10px 0; }
a.quote-row { display: block; text-decoration: none; color: var(--ink); border-radius: 8px; }
a.quote-row:hover { background: var(--bg); }
.quote-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.quote-actions { margin-inline-start: auto; display: flex; gap: 4px; }
.quote-actions a { min-height: 36px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.status-draft { background: var(--bg); color: var(--muted); }
.status-sent { background: var(--tint); color: var(--tint-ink); }
.status-accepted { background: var(--ok-bg); color: var(--ok-ink); }
.status-rejected { background: var(--err-bg); color: var(--err-ink); }

.date-filter { flex: none; }
.date-filter > summary { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; }
.date-filter[open] { flex-basis: 100%; }
.date-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.date-fields label { margin: 0; flex: 1; min-width: 140px; }
.filters { flex-wrap: wrap; }
.export-link { margin: -4px 0 10px; font-size: 13px; }

/* Admin forms */
.crumbs { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.mini-link { font-size: 13px; font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: #fff; }
.img-row { display: flex; gap: 14px; align-items: flex-start; }
.thumb-lg { width: 96px; height: 120px; object-fit: contain; background: var(--bg); border-radius: 10px; flex: none; }
.vcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
.vcard.off { background: #FAFAFC; }
.vcard.deleting { opacity: .5; border-style: dashed; }
.vgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
@media (min-width: 700px) { .vgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.vgrid label { margin-bottom: 8px; }
.vfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; border-top: 1px dashed var(--line); padding-top: 4px; }
.vfoot .check { min-height: 40px; margin: 0; font-size: 13px; }
.move, .rep-tools { margin-inline-start: auto; display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; font-size: 12px; }
.icon-btn:hover { background: var(--bg); color: var(--navy); }
.icon-btn.del:hover { background: var(--err-bg); color: var(--err-ink); }
.sticky-save { position: sticky; bottom: 0; z-index: 5; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 12px; }
.danger-zone { border-color: #F0C9C9; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rep-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; background: #fff; }
.rep-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 10px; }
.rep-fields > .grid-2, .rep-fields > .hint { grid-column: 1 / -1; }
.rep-fields label { margin-bottom: 6px; }
.rep-fields textarea { min-height: 64px; }
.rep-tools { flex-direction: column; }
.rep .btn { margin-top: 2px; }
fieldset.pair { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 10px 0 0; }
fieldset.pair:first-of-type { border-top: 0; padding-top: 0; }
fieldset.pair legend { font-weight: 600; color: var(--navy); font-size: 14px; padding: 0; }
fieldset.pair textarea { min-height: 48px; }
textarea.mono { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.steps { margin: 0; padding-inline-start: 20px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; }
table.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
table.diff th, table.diff td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; vertical-align: top; }
table.diff th { color: var(--muted); font-weight: 600; }
table.diff td.num { direction: ltr; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.diff td.up { color: var(--err-ink); }
table.diff td.down { color: var(--ok-ink); }

/* Home tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-height: 96px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.tile b { font-family: "Noto Kufi Arabic", sans-serif; color: var(--navy); font-size: 15px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile.soon { opacity: .6; border-style: dashed; }

/* Login */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { display: block; width: 220px; max-width: 70%; margin: 0 auto 20px; }

.side-link small.count { background: var(--cyan); color: #fff; font-weight: 700; }
.notif.unread { background: var(--tint); border-radius: 8px; padding-inline: 8px; }
.sp-table .sp-group td { background: var(--bg); }
.sp-table .has-special td { background: #FFFBF3; }
.sp-in input { min-width: 110px; direction: ltr; }
.seg-row { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.btn-wa-sm { background: #1FA855; border-color: #1FA855; color: #fff; }
.btn-wa-sm:hover { background: #178A45; color: #fff; }
.fu.late { background: #FFF8F6; border-radius: 8px; padding-inline: 8px; }
.fu-close { margin-top: 4px; }
.fu-close summary { font-size: 13px; min-height: 40px; }
.fu-today { border-color: var(--cyan); }
table.report td { font-size: 13px; }
.badge-cat { background: #EEE9FF; color: #4B3BA8; font-weight: 600; }

/* Purchase-order status */
.po-sent { background: var(--tint); color: var(--tint-ink); }
.po-review { background: var(--warn-bg); color: var(--warn-ink); }
.po-approved { background: var(--ok-bg); color: var(--ok-ink); }
.po-rejected { background: var(--err-bg); color: var(--err-ink); }
