/* صفحة «الطلبات الإدارية» بهوية النظام (scripts/frontend/admin-requests-redesign.jsx)
   أزرق مخضر عميق #1d4750 وذهبي #c8a96a على خلفية دافئة، ومربعات الحالة أدوات فرز ظاهرة دائماً. */
#root .bar-tools {
  --bar-ink: #1d4750;
  --bar-teal: #2e6874;
  --bar-gold: #c8a96a;
  --bar-gold-dark: #9a7b45;
  --bar-line: #e4e0d2;
  --bar-muted: #6b7f84;
  display: flex; flex-direction: column; gap: 12px;
}

/* مربعات الحالة: كل مربع يفرز الطلبات بحالته */
#root .bar-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 640px) { #root .bar-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } }
@media (min-width: 1180px) { #root .bar-stats { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  #root .bar-stat { gap: 4px; padding: 8px 9px 8px; border-radius: 12px; }
  #root .bar-stat-icon { display: none; }
  #root .bar-stat-label { font-size: 11.5px; }
  #root .bar-stat-num { font-size: 20px; }
  #root .bar-stat-pct { font-size: 10.5px; }
  #root .bar-stat.is-active::after { top: 6px; left: 6px; width: 15px; height: 15px; font-size: 9px; }
  #root .bar-stat[data-tone="all"] { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; padding: 8px 12px; }
  #root .bar-stat[data-tone="all"] .bar-stat-icon { display: grid; }
  #root .bar-stat[data-tone="all"] .bar-stat-meter { display: none; }
  #root .bar-stat[data-tone="all"].is-active::after { position: static; order: 3; }
}

#root .bar-stat {
  --tone: #2e6874; --tone-soft: #eef5f6; --tone-line: #c6dde1;
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 11px 12px 10px; border-radius: 14px; text-align: start; cursor: pointer;
  background: #fff; border: 1px solid var(--bar-line);
  box-shadow: 0 1px 2px rgb(29 71 80 / .05);
  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
#root .bar-stat:hover { border-color: var(--tone-line); box-shadow: 0 6px 16px -10px rgb(29 71 80 / .35); transform: translateY(-1px); }
#root .bar-stat:focus-visible { outline: 2px solid var(--bar-gold); outline-offset: 2px; }
#root .bar-stat[data-tone="all"] { --tone: #1d4750; --tone-soft: #eef4f5; --tone-line: #b9cfd3; }
#root .bar-stat[data-tone="active"] { --tone: #2e6874; --tone-soft: #eaf4f5; --tone-line: #a9cdd3; }
#root .bar-stat[data-tone="overdue"] { --tone: #b42318; --tone-soft: #fef1ef; --tone-line: #f5c2bc; }
#root .bar-stat[data-tone="escalated"] { --tone: #6941c6; --tone-soft: #f4f1fd; --tone-line: #d6cbf7; }
#root .bar-stat[data-tone="completed_on_time"] { --tone: #17803d; --tone-soft: #edf8f0; --tone-line: #b5e0c2; }
#root .bar-stat[data-tone="completed_late"] { --tone: #b4570f; --tone-soft: #fdf3ea; --tone-line: #f1cda9; }
#root .bar-stat[data-tone="rejected"] { --tone: #5f6b70; --tone-soft: #f3f4f4; --tone-line: #d3d8da; }
#root .bar-stat-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
#root .bar-stat-icon { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; background: var(--tone-soft); color: var(--tone); }
#root .bar-stat-label { font-size: 12.5px; font-weight: 800; color: #3b5358; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#root .bar-stat-value { display: flex; align-items: baseline; gap: 6px; }
#root .bar-stat-num { font-size: 26px; line-height: 1; font-weight: 900; color: var(--tone); }
#root .bar-stat-pct { font-size: 11.5px; font-weight: 800; color: var(--bar-muted); }
#root .bar-stat-meter { display: block; height: 4px; border-radius: 99px; background: #f0ede4; overflow: hidden; }
#root .bar-stat-meter i { display: block; height: 100%; border-radius: inherit; background: var(--tone); opacity: .75; }
#root .bar-stat.is-empty .bar-stat-num { color: #a3b1b4; }
#root .bar-stat.is-active { background: var(--tone-soft); border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone), 0 8px 18px -12px var(--tone); }
#root .bar-stat.is-active::after {
  content: "✓"; position: absolute; top: 8px; left: 9px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; background: var(--tone);
}
#root .bar-stat[data-tone="all"].is-active { background: linear-gradient(135deg, #1d4750, #2e6874); border-color: #1d4750; }
#root .bar-stat[data-tone="all"].is-active .bar-stat-label { color: #e2eef0; }
#root .bar-stat[data-tone="all"].is-active .bar-stat-num { color: var(--bar-gold); }
#root .bar-stat[data-tone="all"].is-active .bar-stat-icon { background: rgb(255 255 255 / .12); color: var(--bar-gold); }
#root .bar-stat[data-tone="all"].is-active .bar-stat-meter { background: rgb(255 255 255 / .15); }
#root .bar-stat[data-tone="all"].is-active .bar-stat-meter i { background: var(--bar-gold); }
#root .bar-stat[data-tone="all"].is-active::after { background: var(--bar-gold); color: #1d4750; }

/* لوحة الفرز والتصفية: ظاهرة دائماً */
#root .bar-panel { background: #fff; border: 1px solid var(--bar-line); border-radius: 16px; box-shadow: 0 1px 2px rgb(29 71 80 / .05); overflow: hidden; }
#root .bar-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 9px 14px; background: linear-gradient(90deg, #fbf7ee, #fff); border-bottom: 1px solid #efe9da;
}
#root .bar-panel-title { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 800; color: var(--bar-ink); }
#root .bar-panel-title svg { color: var(--bar-gold-dark); }
#root .bar-panel-actions { display: inline-flex; align-items: center; gap: 8px; }
#root .bar-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px;
  font-size: 12.5px; font-weight: 800; color: #fff; background: var(--bar-teal); border: 1px solid var(--bar-teal); cursor: pointer;
}
#root .bar-btn:hover { background: var(--bar-ink); }
#root .bar-btn:disabled { opacity: .6; cursor: default; }
#root .bar-link { border: 0; background: none; padding: 2px 4px; font-size: 12.5px; font-weight: 800; color: var(--bar-gold-dark); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#root .bar-link:hover { color: #7d6232; }

#root .bar-classes { padding: 10px 14px 0; }
#root .bar-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: thin; }
#root .bar-chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap;
  height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  color: #3b5358; background: #fff; border: 1px solid var(--bar-line);
}
#root .bar-chip:hover { border-color: var(--bar-gold); }
#root .bar-chip-count { min-width: 20px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 800; text-align: center; color: var(--bar-gold-dark); background: #f8f1e1; }
#root .bar-chip.is-active { color: #fff; background: var(--bar-ink); border-color: var(--bar-ink); }
#root .bar-chip.is-active .bar-chip-count { color: var(--bar-ink); background: var(--bar-gold); }

#root .bar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 14px 12px; }
@media (min-width: 760px) { #root .bar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { #root .bar-grid { grid-template-columns: 2fr repeat(6, minmax(0, 1fr)); } }
#root .bar-search { grid-column: 1 / -1; }
@media (min-width: 1180px) { #root .bar-search { grid-column: auto; } }
#root .bar-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#root .bar-field-label { font-size: 11.5px; font-weight: 800; color: var(--bar-muted); }
#root .bar-input {
  width: 100%; min-width: 0; height: 36px; padding: 0 10px; border-radius: 10px; font-size: 13px; color: #24414a;
  background: #fcfbf8; border: 1px solid var(--bar-line); transition: border-color .15s, box-shadow .15s;
}
#root .bar-input:focus { outline: none; border-color: var(--bar-teal); box-shadow: 0 0 0 3px rgb(46 104 116 / .14); background: #fff; }
#root .bar-input.is-set { border-color: var(--bar-gold); background: #fffaf0; color: var(--bar-ink); font-weight: 700; }
#root .bar-search-box { position: relative; display: block; }
#root .bar-search-box svg { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: #93a3a6; pointer-events: none; }
#root .bar-search-box .bar-input { padding-right: 32px; }

#root .bar-panel-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 14px; font-size: 12.5px; color: var(--bar-muted); background: #faf8f2; border-top: 1px solid #efe9da;
}
#root .bar-panel-foot b { color: var(--bar-ink); font-weight: 900; }
#root .bar-selected { padding: 2px 10px; border-radius: 99px; font-weight: 800; color: var(--bar-ink); background: #e2eef0; }

/* صفوف الطلبات */
#root .bar-row { --tone: #2e6874; position: relative; background: #fff; transition: background .15s; }
#root .bar-row::before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 4px; background: var(--tone); opacity: .85; }
#root .bar-row[data-tone="overdue"] { --tone: #b42318; background: #fffaf9; }
#root .bar-row[data-tone="escalated"] { --tone: #6941c6; background: #fcfbff; }
#root .bar-row[data-tone="completed_on_time"] { --tone: #17803d; }
#root .bar-row[data-tone="completed_late"] { --tone: #b4570f; }
#root .bar-row[data-tone="rejected"] { --tone: #8a979b; }
#root .bar-row:hover { background: #fbf9f3; }
#root .bar-row.is-selected { background: #f1f7f8; }
#root .bar-row.is-open { background: #f7fafa; }
#root .bar-row-main { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px 12px 12px; }
#root .bar-check { width: 16px; height: 16px; margin-top: 4px; flex-shrink: 0; border-radius: 4px; accent-color: var(--bar-teal, #2e6874); }
#root .bar-row-body { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
#root .bar-row-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
#root .bar-row-title h3 { margin: 0; min-width: 0; font-size: 14.5px; font-weight: 800; color: #1d4750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#root .bar-status {
  flex-shrink: 0; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 800; white-space: nowrap;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, #fff); border: 1px solid color-mix(in srgb, var(--tone) 28%, #fff);
}
#root .bar-type { flex-shrink: 0; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; color: #7d6232; background: #f8f1e1; white-space: nowrap; }
#root .bar-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--bar-muted, #6b7f84); }
#root .bar-meta b { font-weight: 800; color: #2c4a52; }
#root .bar-meta .bar-late, #root .bar-meta .bar-late b { color: #b42318; }
#root .bar-muted { color: #9aa8ab; }
#root .bar-row-side { display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-inline-start: auto; }
#root .bar-date { font-size: 11.5px; font-weight: 600; color: #5d7378; text-align: end; }
#root .bar-row-buttons { display: inline-flex; align-items: center; gap: 6px; }
#root .bar-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  color: #5d7378; background: #fff; border: 1px solid var(--bar-line, #e4e0d2); transition: background .15s, color .15s, border-color .15s;
}
#root .bar-icon:hover { color: #1d4750; border-color: #c8a96a; }
#root .bar-icon.is-bell { color: #9a7b45; background: #fbf5e8; border-color: #e6d3a8; }
#root .bar-icon.is-bell:hover { background: #f6ebd1; }
#root .bar-icon:disabled { opacity: .55; cursor: default; }
#root .bar-icon.is-toggle svg { transition: transform .2s; }
#root .bar-icon.is-toggle.is-active { color: #fff; background: #2e6874; border-color: #2e6874; }
#root .bar-icon.is-toggle.is-active svg { transform: rotate(180deg); }
@media (max-width: 639px) {
  #root .bar-row-main { gap: 8px 10px; padding: 11px 14px 11px 10px; }
  #root .bar-row-title { flex-wrap: wrap; }
  #root .bar-row-title h3 { flex-basis: 100%; white-space: normal; }
  #root .bar-row-side { width: 100%; justify-content: space-between; padding-inline-start: 26px; }
}

/* رؤوس المجموعات */
#root .bar-group-head { background: linear-gradient(90deg, #f6f1e4, #fbf9f3) !important; border-bottom: 1px solid #ece4cf; }
#root .bar-group-head:hover { background: #f3ecdb !important; }
#root .bar-group-head h2 { color: #1d4750 !important; }
#root .bar-group-icon { background: #1d4750 !important; color: #e3c98f !important; }
