/* =============================================================
   AL-ETEMAD · ADMIN DASHBOARD
   Inherits the brand palette from style.css (:root variables).
   ============================================================= */
.admin{ background:radial-gradient(circle at 50% -10%, #ffffff, var(--bg) 60%); min-height:100vh; }
.admin .brandmark{ width:46px; }
.dash__logo{ height:32px; width:auto; display:block; }
.admin [hidden]{ display:none !important; }

/* ---------- shared controls ---------- */
.afield{ display:grid; gap:7px; }
.afield > span{ font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--grey); }
.afield input, .afield textarea, .afield select{
  width:100%; padding:13px 15px; border:1px solid var(--line); border-radius:11px;
  background:var(--black); color:var(--ivory); font:inherit; font-size:15px;
  transition:border-color .3s, box-shadow .3s, background .3s; -webkit-appearance:none; appearance:none;
}
.afield textarea{ resize:vertical; min-height:54px; }
.afield select{ cursor:pointer; background-image:linear-gradient(45deg,transparent 50%,var(--gold) 50%),linear-gradient(135deg,var(--gold) 50%,transparent 50%); background-position:calc(100% - 20px) center,calc(100% - 14px) center; background-size:6px 6px,6px 6px; background-repeat:no-repeat; }
html[dir="rtl"] .afield select{ background-position:20px center,26px center; }
.afield input:focus, .afield textarea:focus, .afield select:focus{
  outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(189,138,36,.16); background:var(--black-2);
}

.abtn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:13px 24px; border-radius:44px;
  font:inherit; font-weight:700; font-size:14px; letter-spacing:.02em; cursor:pointer; transition:transform .3s var(--ease),background .3s,border-color .3s,opacity .3s; }
.abtn--gold{ background:var(--cta); color:var(--cta-ink); }
.abtn--gold:hover{ background:var(--cta-soft); transform:translateY(-2px); }
.abtn--ghost{ background:transparent; border:1px solid var(--line); color:var(--ivory); }
.abtn--ghost:hover{ border-color:var(--gold); color:var(--gold); }
.abtn--sm{ padding:9px 16px; font-size:13px; }
.abtn--wa{ background:#25d366; color:#07240f; font-weight:700; }
.abtn--wa:hover{ background:#1fb457; transform:translateY(-2px); }
.abtn[disabled]{ opacity:.5; pointer-events:none; }

/* ---------- LOGIN ---------- */
.login{ min-height:100vh; display:grid; place-items:center; padding:24px; }
.login__card{ width:min(420px,100%); border:1px solid var(--line); border-radius:24px; padding:clamp(30px,5vw,48px);
  background:linear-gradient(180deg,var(--black-2),var(--black)); text-align:center; box-shadow:0 30px 70px rgba(35,33,28,.14); }
.login__mark{ width:64px; margin:0 auto 14px; }
.login__logo{ height:60px; width:auto; margin:0 auto 16px; display:block; }
.login__title{ font-family:var(--serif); font-size:34px; font-weight:600; }
.login__sub{ color:var(--grey); font-size:13px; letter-spacing:.12em; text-transform:uppercase; margin-top:4px; }
.login__form{ display:grid; gap:16px; margin-top:30px; text-align:start; }
.login__err{ color:#e0913a; font-size:13px; min-height:16px; margin:0; text-align:center; }
.login__mode{ margin-top:22px; font-size:12px; color:var(--graphite); letter-spacing:.04em; }
.login__mode b{ color:var(--gold); }
.login__back{ display:inline-block; margin-top:14px; color:var(--grey); font-size:13px; transition:color .3s; }
.login__back:hover{ color:var(--gold); }

/* password show/hide toggle (login) */
.pass-field{ position:relative; display:flex; align-items:stretch; }
.pass-field input{ flex:1; padding-inline-end:48px; }
.pass-toggle{ position:absolute; inset-inline-end:6px; top:50%; transform:translateY(-50%);
  display:grid; place-items:center; width:36px; height:36px; border-radius:9px;
  color:var(--grey); transition:color .2s, background .2s; }
.pass-toggle:hover{ color:var(--cta); background:var(--ink); }
.pass-toggle:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; }
.pass-toggle svg{ display:block; }

/* ---------- DASHBOARD shell ---------- */
.dash{ max-width:1300px; margin-inline:auto; padding:clamp(16px,3vw,32px); }
.dash__bar{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding-bottom:22px; border-bottom:1px solid var(--line); }
.dash__brand{ display:flex; align-items:center; gap:12px; font-family:var(--serif); font-size:24px; }
.dash__mode{ font-family:var(--sans); font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  padding:5px 11px; border-radius:30px; border:1px solid var(--line); color:var(--gold); }
.dash__mode.is-local{ color:var(--grey); }
.dash__actions{ display:flex; gap:10px; }

.dash__tabs{ display:flex; gap:14px 26px; margin:24px 0; flex-wrap:wrap; align-items:flex-start; }
.dash__group{ display:flex; flex-direction:column; gap:9px; }
.dash__group + .dash__group{ padding-inline-start:26px; border-inline-start:1px solid var(--line); }
.dash__group-label{ font-family:var(--sans); font-size:11px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); padding-inline-start:6px; }
.dash__group-tabs{ display:flex; gap:10px; flex-wrap:wrap; }
.dash__tab{ padding:11px 22px; border:1px solid var(--line); border-radius:40px; font-weight:600; font-size:14px; color:var(--grey); transition:all .3s var(--ease); }
.dash__tab:hover{ border-color:var(--grey); }
.dash__tab.is-active{ background:var(--cta); color:var(--cta-ink); border-color:var(--cta); box-shadow:0 6px 16px rgba(31,94,84,.22); }
@media (max-width:640px){
  .dash__group + .dash__group{ padding-inline-start:0; border-inline-start:0; padding-top:14px; border-top:1px solid var(--line); width:100%; }
}

.panel{ display:none; }
.panel.is-active{ display:block; animation:fadeUp .5s var(--ease-out); }
@keyframes fadeUp{ from{ opacity:0; transform:translateY(14px);} to{ opacity:1; transform:none;} }
.panel__grid{ display:grid; grid-template-columns:minmax(0,440px) 1fr; gap:24px; align-items:start; }

.card{ border:1px solid var(--line); border-radius:20px; background:linear-gradient(180deg,var(--black-2),var(--black)); padding:clamp(20px,2.5vw,30px); }

/* ---------- editor ---------- */
.editor{ display:grid; gap:16px; }
.editor__title{ font-family:var(--serif); font-size:24px; font-weight:600; }
.editor__actions{ display:flex; gap:10px; flex-wrap:wrap; }
.editor__actions .abtn{ flex:1 1 auto; }
.editor__actions .abtn--cancel{ flex:0 0 auto; }
.editor__msg{ font-size:13px; min-height:16px; margin:0; }
.editor__msg.ok{ color:#1c8f46; } .editor__msg.err{ color:#e0913a; }

/* =============================================================
   DESKTOP: two-column dashboard that scrolls as ONE normal page.
   The page scrolls naturally; each column grows to fit its content
   and the taller column defines the page height. The editor's action
   bar stays reachable via position:sticky (no height lock anywhere).
   ============================================================= */
@media (min-width:881px){
  .dash{ min-height:100vh; display:flex; flex-direction:column; }
  .dash__main{ flex:1; }
  .panel__grid{ align-items:start; }   /* columns top-align, grow independently */

  /* sticky action bar — Save / Publish stays reachable while the page scrolls */
  .editor{ padding-bottom:0; }
  .editor__actions{
    position:sticky; bottom:0; z-index:6;
    margin:4px calc(-1 * clamp(20px,2.5vw,30px)) 0;
    padding:16px clamp(20px,2.5vw,30px) clamp(20px,2.5vw,30px);
    background:linear-gradient(180deg, transparent, var(--black-2) 35%);
  }
}

/* segmented control (image/video) */
.seg{ display:flex; gap:6px; padding:5px; border:1px solid var(--line); border-radius:40px; }
.seg__opt{ flex:1; text-align:center; padding:9px; border-radius:30px; font-size:14px; font-weight:600; color:var(--grey); cursor:pointer; transition:all .3s var(--ease); }
.seg__opt input{ display:none; }
.seg__opt.is-active{ background:var(--cta); color:var(--cta-ink); }

/* drag & drop zone */
.drop{ position:relative; border:2px dashed var(--line); border-radius:16px; min-height:170px; display:grid; place-items:center;
  cursor:pointer; transition:border-color .3s,background .3s; overflow:hidden; text-align:center; }
.drop:hover, .drop:focus-visible{ border-color:var(--gold); background:rgba(189,138,36,.05); outline:none; }
.drop.is-drag{ border-color:var(--gold); background:rgba(189,138,36,.1); }
.drop__inner{ padding:24px; color:var(--grey); }
.drop__ico{ width:40px; height:40px; margin:0 auto 10px; fill:none; stroke:var(--gold); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.drop__txt{ font-size:14px; line-height:1.7; }
.drop__txt small{ color:var(--graphite); }
.drop__preview{ position:absolute; inset:0; background:var(--ink); }
.drop__preview video, .drop__preview img{ width:100%; height:100%; object-fit:contain; }
.drop__clear{ position:absolute; top:10px; inset-inline-end:10px; z-index:3; width:32px; height:32px; border-radius:50%;
  background:rgba(0,0,0,.6); color:#fff; display:grid; place-items:center; backdrop-filter:blur(4px); }
.drop__clear:hover{ background:var(--cta); color:var(--cta-ink); }

/* color swatches */
.swatches{ display:flex; flex-wrap:wrap; gap:9px; }
.swatch{ width:30px; height:30px; border-radius:50%; outline:1px solid var(--line); border:2px solid transparent; cursor:pointer; transition:transform .25s,border-color .25s; }
.swatch:hover{ transform:scale(1.12); }
.swatch.is-active{ border-color:var(--ivory); transform:scale(1.12); }
.swatch--custom{ position:relative; display:grid; place-items:center; background:conic-gradient(red,orange,yellow,lime,cyan,blue,magenta,red); color:#fff; font-size:16px; font-weight:700; }
.swatch--custom input{ position:absolute; inset:0; opacity:0; cursor:pointer; }

/* ---------- list ---------- */
.list__head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.list__head h2{ font-family:var(--serif); font-size:22px; font-weight:600; }
.list__count{ font-size:12px; font-weight:700; color:var(--gold); border:1px solid var(--line); border-radius:30px; padding:4px 12px; }
.list__items{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:14px; }
.list__empty{ grid-column:1/-1; text-align:center; color:var(--grey); padding:50px 20px; }

.icard{ position:relative; border:1px solid var(--line); border-radius:14px; overflow:hidden; background:var(--ink); }
.icard__media{ aspect-ratio:4/5; background:var(--line) center/cover no-repeat; position:relative; }
.icard__media video{ width:100%; height:100%; object-fit:cover; }
.icard__badge{ position:absolute; top:8px; inset-inline-start:8px; z-index:2; font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  padding:4px 9px; border-radius:20px; background:rgba(0,0,0,.6); color:var(--gold); backdrop-filter:blur(4px); }
.icard__play{ position:absolute; inset:0; display:grid; place-items:center; color:#fff; font-size:30px; pointer-events:none; text-shadow:0 2px 10px rgba(0,0,0,.6); }
.icard__body{ padding:11px 12px 13px; }
.icard__title{ font-size:14px; font-weight:600; line-height:1.3; display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.icard__sub{ font-size:11px; color:var(--grey); margin-top:2px; display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.icard__row{ display:flex; gap:6px; margin-top:10px; }
.icard__btn{ flex:1; padding:7px; border-radius:8px; font-size:12px; font-weight:600; border:1px solid var(--line); transition:all .25s; }
.icard__btn--edit:hover{ border-color:var(--gold); color:var(--gold); }
.icard__btn--del:hover{ border-color:#e0913a; color:#e0913a; }
.icard__tag{ position:absolute; top:8px; inset-inline-end:8px; z-index:2; width:16px; height:16px; border-radius:50%; outline:1px solid rgba(255,255,255,.4); }

/* ---------- toast ---------- */
.toast{ position:fixed; inset-block-end:24px; inset-inline:0; margin-inline:auto; width:max-content; max-width:90%;
  background:var(--ivory); color:var(--black); padding:13px 24px; border-radius:40px; font-weight:600; font-size:14px;
  box-shadow:0 20px 50px rgba(35,33,28,.22); z-index:9999; animation:toastIn .35s var(--ease-out); }
.toast.err{ background:#e0913a; }
.toast.ok{ background:#1c8f46; }
@keyframes toastIn{ from{ opacity:0; transform:translateY(20px);} to{ opacity:1; transform:none;} }

/* Light-theme: soft, warm shadows (replace the dark-era heavy black shadows). */
.login__card{ box-shadow:0 24px 60px rgba(35,33,28,.10); }
.card{ box-shadow:0 8px 26px rgba(35,33,28,.05); }

/* ===== Maps section (الخرايط) ===== */
.maps-print{ margin-top:18px; padding-top:16px; border-top:1px solid var(--line); display:grid; gap:12px; }
.maps-crew-row{ display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; margin-bottom:8px; }
.maps-crew-row__num{ display:grid; place-items:center; min-width:24px; height:24px; border-radius:50%; background:var(--ink); color:var(--ivory); font-size:12px; font-weight:800; }
.maps-crew-row__name{ flex:1; font-weight:600; }
.maps-crew-row__del{ color:#c0392b; font-size:13px; border:1px solid var(--line); border-radius:20px; padding:5px 12px; transition:all .2s; }
.maps-crew-row__del:hover{ border-color:#c0392b; }
.maps-batch{ border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:14px; }
.maps-batch__head{ font-size:12px; color:var(--grey); letter-spacing:.05em; margin-bottom:10px; text-transform:uppercase; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.maps-batch__sel{ font-size:12px; font-weight:700; color:var(--cta); background:none; border:1px solid var(--line); border-radius:20px; padding:4px 14px; cursor:pointer; text-transform:none; letter-spacing:0; transition:border-color .2s,background .2s; }
.maps-batch__sel:hover{ border-color:var(--cta); background:rgba(31,94,84,.06); }
.maps-card__del{ position:absolute; bottom:6px; inset-inline-end:6px; z-index:4; width:24px; height:24px; border-radius:50%; border:none; cursor:pointer; background:rgba(192,57,43,.92); color:#fff; font-size:12px; line-height:1; display:grid; place-items:center; opacity:.9; transition:opacity .2s,background .2s; }
.maps-card__del:hover{ background:#c0392b; opacity:1; }
/* «منفرجة» special (manual-assign) group */
.maps-batch--special{ border-color:#c0783a; background:rgba(192,120,58,.05); }
.maps-batch__badge{ color:#c0783a; font-weight:800; }
.maps-card--special{ outline:2px solid #c0783a; outline-offset:-2px; }
.maps-special{ display:flex; gap:10px; margin-top:12px; align-items:center; flex-wrap:wrap; }
.maps-special__crew{ flex:1; min-width:160px; padding:9px 12px; border:1px solid var(--line); border-radius:10px; background:var(--black-2); color:var(--ivory); font:inherit; font-size:14px; }
.maps-special__crew:focus{ outline:none; border-color:var(--gold); }
.maps-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px; }
.maps-card{ position:relative; border:1px solid var(--line); border-radius:12px; overflow:hidden; cursor:pointer; aspect-ratio:3/4; background:var(--ink); }
.maps-card img{ width:100%; height:100%; object-fit:cover; }
.maps-card.is-broken img{ display:none; }
.maps-card.is-broken::after{ content:"⚠ تعذّر تحميل الصورة"; position:absolute; inset:0; display:grid; place-items:center; padding:8px; text-align:center; font-size:11px; color:var(--grey); }
.maps-card__num{ position:absolute; top:6px; inset-inline-start:6px; background:var(--ivory); color:var(--black); font-size:12px; font-weight:800; border-radius:20px; min-width:22px; height:22px; display:grid; place-items:center; }
.maps-card__check{ position:absolute; top:6px; inset-inline-end:6px; width:22px; height:22px; border-radius:50%; border:2px solid #fff; background:rgba(0,0,0,.35); display:grid; place-items:center; color:#fff; font-size:13px; }
.maps-card.is-sel{ outline:3px solid var(--cta); outline-offset:-3px; }
.maps-card.is-sel .maps-card__check{ background:var(--cta); border-color:var(--cta); }
.maps-card__crew{ position:absolute; bottom:0; inset-inline:0; background:linear-gradient(0deg,rgba(0,0,0,.7),transparent); color:#fff; font-size:11px; padding:14px 8px 6px; }

/* Print surface — hidden on screen, shown only when printing. */
.maps-print-root{ display:none; }
@media print{
  body.admin > *:not(.maps-print-root){ display:none !important; }
  .maps-print-root{ display:block !important; }
  .maps-print-page{ page-break-after:always; display:flex; align-items:center; justify-content:center; width:100%; height:100vh; }
  .maps-print-page:last-child{ page-break-after:auto; }
  .maps-print-page img{ max-width:100%; max-height:100vh; object-fit:contain; }
}

/* ---------- sort bar ---------- */
.sort-bar{ display:flex; align-items:center; gap:10px; padding:10px 0 14px; border-bottom:1px solid var(--line); margin-bottom:14px; }
.sort-bar__label{ font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--grey); white-space:nowrap; }
.sort-sel{ padding:7px 28px 7px 12px; border:1px solid var(--line); border-radius:8px; background:var(--black-2); color:var(--ivory);
  font:inherit; font-size:13px; cursor:pointer; -webkit-appearance:none; appearance:none;
  background-image:linear-gradient(45deg,transparent 50%,var(--gold) 50%),linear-gradient(135deg,var(--gold) 50%,transparent 50%);
  background-position:calc(100% - 14px) center,calc(100% - 8px) center; background-size:5px 5px,5px 5px; background-repeat:no-repeat; }
html[dir="rtl"] .sort-sel{ background-position:14px center,20px center; padding:7px 12px 7px 28px; }
.sort-sel:focus{ outline:none; border-color:var(--gold); }

/* ---------- publish status badges ---------- */
.icard__status{ position:absolute; bottom:8px; inset-inline-end:8px; z-index:3; font-size:9px; font-weight:700;
  letter-spacing:.07em; padding:3px 8px; border-radius:20px; backdrop-filter:blur(4px); }
.icard__status.is-pub{ background:rgba(74,208,122,.25); color:#1c8f46; }
.icard__status.is-draft{ background:rgba(224,145,58,.25); color:#e0913a; }

/* publish / unpublish action buttons */
.icard__btn--pub{ color:#1c8f46; border-color:rgba(74,208,122,.4); font-weight:700; margin-bottom:6px; width:100%; }
.icard__btn--pub:hover{ background:rgba(74,208,122,.12); border-color:#1c8f46; }
.icard__btn--unpub{ color:var(--grey); border-color:var(--line); margin-bottom:6px; width:100%; font-size:11px; }
.icard__btn--unpub:hover{ color:#e0913a; border-color:#e0913a; }

/* ---------- two-column catalog drop zones ---------- */
.cat-drops{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.cat-drops__label{ font-size:11px; letter-spacing:.07em; text-transform:uppercase; color:var(--grey); margin-bottom:6px; }
.cat-drops__dim{ color:var(--gold); font-weight:700; letter-spacing:.04em; margin-inline-start:6px; }

/* drop zones with baked-in aspect ratio matching the actual images */
.drop--ratio-34{ aspect-ratio:3/4; min-height:unset; }
.drop--ratio-23{ aspect-ratio:2/3; min-height:unset; }

/* ---------- admin list extras ---------- */
.list__section-label{ font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--grey);
  padding:14px 4px 8px; border-top:1px solid var(--line); margin-top:14px; }
.list__section-label:first-child{ border-top:none; margin-top:0; padding-top:4px; }

.icard--seed{ opacity:.72; }
.icard--seed .icard__media{ background:var(--black-2)!important; }
.icard__seed{ position:absolute; bottom:8px; inset-inline-start:8px; z-index:2; font-size:9px; font-weight:700;
  letter-spacing:.07em; padding:3px 8px; border-radius:20px; background:rgba(139,139,146,.25); color:var(--grey); backdrop-filter:blur(4px); }
.icard__seed-note{ font-size:11px; color:var(--graphite); margin-top:6px; line-height:1.4; }
.icard__detail-badge{ position:absolute; bottom:8px; inset-inline-end:8px; z-index:2; font-size:9px; font-weight:700;
  letter-spacing:.06em; padding:3px 8px; border-radius:20px; background:rgba(189,138,36,.3); color:var(--gold); backdrop-filter:blur(4px); }

.icard--builtin .icard__media{ min-height:60px; }
.icard--hidden{ opacity:.5; }
.icard__hidden-badge{ position:absolute; top:8px; inset-inline-start:8px; z-index:2; font-size:9px; font-weight:700;
  letter-spacing:.07em; padding:3px 8px; border-radius:20px; background:rgba(224,145,58,.4); color:#e0913a; backdrop-filter:blur(4px); }
.mini-swatch{ width:20px; height:20px; border-radius:50%; outline:1px solid rgba(255,255,255,.1); flex:none; }

/* built-in category sections */
.builtin-cat{ margin-bottom:6px; }
.builtin-cat__head{ display:flex; align-items:center; justify-content:space-between; padding:10px 4px 6px;
  font-size:12px; font-weight:700; color:var(--grey); letter-spacing:.06em; }
.builtin-cat__count{ font-size:11px; color:var(--gold); border:1px solid var(--line); border-radius:20px; padding:2px 8px; }
.builtin-cat__grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; }
.builtin-show-more{ width:100%; padding:10px; border:1px dashed var(--line); border-radius:10px; font-size:13px;
  color:var(--grey); margin-top:8px; transition:border-color .3s,color .3s; }
.builtin-show-more:hover{ border-color:var(--gold); color:var(--gold); }

/* ---------- thumbnail chip in modal ---------- */
.mview__thumb-chip{ display:inline-flex; align-items:center; gap:8px; margin-bottom:14px;
  padding:6px 12px 6px 6px; border:1px solid var(--line); border-radius:40px; font-size:12px; color:var(--grey); }
.mview__thumb-chip img{ width:32px; height:32px; border-radius:30px; object-fit:cover; }

/* ---------- reviews ---------- */
.stars-input{ display:flex; gap:6px; }
.stars-input button{ font-size:26px; line-height:1; background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.18); transition:color .15s, transform .15s; padding:0; }
.stars-input button:hover{ transform:scale(1.12); }
.stars-input button.is-on{ color:var(--gold); }
.stars-input__clear{ font-size:11px!important; color:var(--grey)!important; align-self:center;
  margin-inline-start:8px; text-decoration:underline; }
.drop--sm{ min-height:120px; }
.icard__stars{ display:flex; gap:2px; font-size:13px; color:var(--gold); margin-top:4px; }
.icard__avatar{ position:absolute; top:8px; inset-inline-end:8px; z-index:2; width:40px; height:40px;
  border-radius:50%; object-fit:cover; border:2px solid rgba(255,255,255,.2); }
.icard__review-text{ font-size:12px; color:var(--grey); line-height:1.5; margin-top:4px;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

/* ---------- responsive ---------- */
@media (max-width:880px){
  .panel__grid{ grid-template-columns:1fr; }
  .cat-drops{ grid-template-columns:1fr; }

  /* On phones/tablets the page scrolls, but the Save / Publish bar stays
     pinned to the bottom of the viewport so it's always reachable while
     filling the form — no need to scroll to the very bottom. */
  .editor{ position:relative; }
  .editor__actions{
    position:sticky; bottom:0; z-index:6;
    margin:6px calc(-1 * clamp(20px,2.5vw,30px)) calc(-1 * clamp(20px,2.5vw,30px));
    padding:14px clamp(20px,2.5vw,30px) clamp(18px,2.5vw,26px);
    background:linear-gradient(180deg, rgba(22,22,26,0), var(--black-2) 38%);
    backdrop-filter:blur(2px);
  }
}

/* =============================================================
   MAINTENANCE
   ============================================================= */
.dash__tab-badge{
  display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 6px;
  margin-inline-start:6px; border-radius:20px; background:#e03a26; color:#fff;
  font-size:11px; font-weight:800; line-height:1; vertical-align:middle;
}
.editor__hint{ margin:-6px 0 14px; font-size:13px; color:var(--grey); line-height:1.6; }

.mcard{
  border:1px solid var(--line); border-radius:14px; background:var(--ink);
  padding:16px 18px; margin-bottom:14px; transition:border-color .3s var(--ease);
}
.mcard:hover{ border-color:var(--grey); }
.mcard.is-done{ opacity:.72; }
.mcard__head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.mcard__who{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.mcard__who strong{ font-family:var(--serif); font-size:18px; color:var(--ivory); }
.mcard__code{
  font-family:var(--mono,monospace); font-size:13px; font-weight:700; letter-spacing:1px;
  color:var(--gold); background:rgba(189,138,36,.1); border:1px solid rgba(189,138,36,.3);
  border-radius:8px; padding:2px 10px;
}
.mcard__src{ font-size:11px; font-weight:700; color:var(--grey); border:1px solid var(--line); border-radius:20px; padding:2px 10px; }
.mcard__src--admin{ color:#2f6fb0; border-color:rgba(47,111,176,.4); }
.mcard__status{ flex:none; font-size:12px; font-weight:700; border-radius:20px; padding:5px 14px; }
.mcard__status--pending{ color:#e0a83a; background:rgba(224,168,58,.12); border:1px solid rgba(224,168,58,.4); }
.mcard__status--done{ color:#1c8f46; background:rgba(34,180,90,.12); border:1px solid rgba(34,180,90,.4); }
.mcard__grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px 18px; margin-bottom:12px; }
.mcard__grid>div{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.mcard__grid span{ font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey); }
.mcard__grid b{ font-size:14px; color:var(--ivory); font-weight:600; word-break:break-word; }
.mcard__details{ border-top:1px solid var(--line); padding-top:12px; margin-bottom:14px; }
.mcard__details span{ display:block; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey); margin-bottom:4px; }
.mcard__details p{ margin:0; font-size:15px; color:var(--ivory); line-height:1.6; white-space:pre-wrap; word-break:break-word; }
.mcard__actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.mcard__wa{ color:#25d366 !important; border-color:rgba(37,211,102,.4) !important; }
.mcard__wa:hover{ background:rgba(37,211,102,.12) !important; border-color:#25d366 !important; }

@media (max-width:560px){
  .mcard__grid{ grid-template-columns:1fr; }
}

/* =============================================================
   CONTROL PANEL — invoice · reps · orders · crews
   ============================================================= */
.req{ color:#e0a83a; font-weight:800; }
.afield-row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.afield-sel{ width:100%; }
.afield-note{ font-size:12px; font-style:normal; color:var(--grey); min-height:16px; }
.afield-note.is-ok{ color:#1c8f46; }
.afield-note.is-err{ color:#e03a26; }

/* full-width panel (orders list) + stacked column (crews boxes 2+3) */
.panel__wide{ display:grid; grid-template-columns:1fr; }
.panel__stack{ display:grid; gap:24px; align-content:start; }

/* issued invoice / added rep result blocks */
.inv-done{ border:1px solid var(--line); border-radius:14px; background:var(--ink); padding:16px 18px; }
.inv-done__code{
  display:flex; align-items:center; justify-content:center; gap:12px;
  background:rgba(189,138,36,.08); border:1px solid rgba(189,138,36,.35);
  border-radius:12px; padding:12px 16px; margin-bottom:14px;
}
.inv-done__code span{ font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey); }
.inv-done__code b{
  font-family:var(--mono,monospace); font-size:22px; font-weight:800; letter-spacing:3px; color:var(--gold);
}
.inv-warn{
  margin:0 0 12px; padding:10px 14px; border-radius:10px; font-size:13px; line-height:1.7;
  color:#e0a83a; background:rgba(224,168,58,.1); border:1px solid rgba(224,168,58,.4);
}
.rep-added{ margin-top:16px; border-top:1px solid var(--line); padding-top:16px; }

/* rep search */
.rep-search{ display:flex; gap:10px; margin-bottom:16px; }
.rep-search__input{
  flex:1; min-width:0; background:var(--black-2); border:1px solid var(--line); border-radius:10px;
  color:var(--ivory); padding:11px 14px; font-size:15px; font-family:inherit;
}
.rep-search__input:focus{ outline:none; border-color:var(--gold); }
.rep-card{ border:1px solid var(--line); border-radius:14px; background:var(--ink); padding:16px 18px; }

/* rep-application review queue (مندوبين قيد المراجعة) */
.review-queue{ margin-top:24px; }
.repapp-card__id{ margin:2px 0 14px; display:grid; gap:6px; }
.repapp-card__id > span{ font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey); }
.repapp-card__id img{ max-width:220px; max-height:150px; border-radius:10px; border:1px solid var(--line); object-fit:cover; background:var(--black-2); }
.repapp-card__id.is-broken img{ display:none; }
.repapp-card__id.is-broken::after{ content:"⚠ تعذّر تحميل الصورة"; font-size:12px; color:var(--grey); }
.repapp-card__result{ margin-top:12px; border-top:1px solid var(--line); padding-top:12px; }
.repapp-reject, .ord-del, .mnt-del{ color:#c0392b; border-color:rgba(192,57,43,.4); }
.repapp-reject:hover, .ord-del:hover, .mnt-del:hover{ border-color:#c0392b; color:#c0392b; background:rgba(192,57,43,.06); }

/* data-rich cards span the whole list width (the auto-fill grid is for
   the small icard media tiles only) */
.list__items > .mcard,
.list__items > .inv-done,
.list__items > .rep-card,
.list__items > .ltable{ grid-column:1/-1; }

/* amounts / phones / dates never wrap mid-number */
.mcard__grid b.money{ white-space:nowrap; word-break:normal; direction:ltr; unicode-bidi:isolate; }

/* balances — highlight the payout cap (المبلغ المتبقي) */
.mcard__grid .is-remaining b, .crew-balance .is-remaining b{ color:#1c8f46; font-size:16px; }
.crew-balance{ margin-bottom:14px; }
.payout{ border-top:1px solid var(--line); padding-top:14px; display:grid; gap:10px; }

/* order cards (قيد التثبيت) */
.ocard__install{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  border-top:1px solid var(--line); padding-top:12px;
}
.ocard__install .sort-sel{ min-width:170px; }
.ocard__date{
  background:var(--black-2); border:1px solid var(--line); border-radius:8px;
  color:var(--ivory); padding:7px 12px; font-size:14px; font-family:inherit;
  color-scheme:dark;
}
.ocard__date:focus{ outline:none; border-color:var(--gold); }
/* second payment (cash) — full-width row above the install controls */
.ocard__second{ margin:12px 0 0; }
.ocard__pay{
  background:var(--black-2); border:1px solid var(--line); border-radius:8px;
  color:var(--ivory); padding:8px 12px; font-size:14px; font-family:inherit; width:100%;
}
.ocard__pay:focus{ outline:none; border-color:var(--gold); }

/* Box 3 — still-owing customer cards */
.owing-pay{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:12px;
  border-top:1px solid var(--line); padding-top:12px; }
.owing-pay .ocard__pay{ flex:1 1 160px; width:auto; }
.owing-rem{ white-space:nowrap; }

/* withdrawals log table */
.ltable{ width:100%; border-collapse:collapse; }
.ltable th{
  text-align:right; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey);
  padding:8px 10px; border-bottom:1px solid var(--line);
}
.ltable td{ padding:9px 10px; font-size:14px; color:var(--ivory); border-bottom:1px solid rgba(255,255,255,.05); }
.ltable tr:last-child td{ border-bottom:none; }

/* compact crew-order cards */
.mcard--mini{ padding:12px 14px; }
.mcard--mini .mcard__grid{ margin-bottom:0; }

/* maintenance crew selector */
.mcard__crew{ min-width:160px; }

@media (max-width:560px){
  .afield-row{ grid-template-columns:1fr; }
  .ocard__install{ align-items:stretch; flex-direction:column; }
  .rep-search{ flex-direction:column; }
}
