/* The app shell (js/core/shell.js): desktop sidebar (full 248 / thin 84) + header, phone top bar + bottom tab bar.
   Desktop >= 1100 px: sidebar full or thin (the owner's choice). Tablet 701-1099: sidebar always thin.
   Phone <= 700: no sidebar; top bar + bottom tab bar (+ «المزيد» sheet). Layout "bare" (login, start, live): no shell.
   Direction-safe (docs/I18N_V4.md): logical sides (inline-start = right in Arabic, left in English), so English
   (dir=ltr) mirrors the whole shell: the sidebar goes to the left. */

.app { min-height: 100vh; min-height: 100dvh; }
.app[data-layout="app"] { padding: 20px; display: flex; gap: 20px; align-items: flex-start; }
.app[data-layout="bare"] .sb,
.app[data-layout="bare"] .hdr,
.app[data-layout="bare"] .ptop,
.app[data-layout="bare"] .tabbar { display: none; }
.app[data-layout="bare"] .main { display: block; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.page { display: flex; flex-direction: column; gap: var(--gap-section); min-width: 0; outline: none; }
.app[data-layout="bare"] .page { display: block; min-height: 100vh; min-height: 100dvh; }

/* ---------- Sidebar ---------- */
.sb {
  flex: none; width: var(--sb-full); position: sticky; top: 20px;
  height: calc(100vh - 40px); min-height: 620px;
  background: var(--card); border-radius: var(--r-shell); padding: 22px 14px 14px;
  display: flex; flex-direction: column; gap: 4px;
  transition: width var(--t-sb) var(--ease);
}
.sb-top { display: flex; align-items: center; gap: 10px; padding: 0 0 24px; }
.logo {
  width: 44px; height: 44px; /* the eyes mark (.bm, base.css) replaced the green circle with the asterisk */
  display: grid; place-items: center; flex: none; text-decoration: none;
}
.sb-brand { flex: 1; }
/* Full sidebar: the full logo (.bf: eyes + the word, 411x512) in place of the eyes mark; thin and tablet keep the eyes (.bm). */
.sb .logo .bf { display: none; }
.app:not([data-sb="thin"]) .sb .logo { width: 55px; height: 68px; }
.app:not([data-sb="thin"]) .sb .logo .bm { display: none; }
.app:not([data-sb="thin"]) .sb .logo .bf { display: block; }
.app:not([data-sb="thin"]) .sb .sb-toggle { align-self: flex-start; margin-top: 4px; } /* same place as beside the old 44 px box */
.sb-toggle {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--card-2); color: var(--text);
  display: grid; place-items: center; flex: none;
}
.sb-toggle .ph { font-size: 16px; }
.sb-label { font-size: var(--fs-small); color: var(--muted-2); padding: 0 14px 6px; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }

/* A nav item (also the rows of the phone «المزيد» sheet) */
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 52px;
  border-radius: var(--r-pill); font-size: var(--fs-ui); text-align: start; color: var(--text);
  padding-block: 0; padding-inline: 8px 14px; background: transparent; text-decoration: none; border: none; width: 100%;
  transition: background var(--t-fast);
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item[aria-current="page"] { background: var(--white); color: var(--ink); font-weight: 500; }
.nav-item[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.nav-ic {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--card-2); color: var(--text);
}
.nav-ic .ph, .nav-ic .ph-fill { font-size: 18px; }
.nav-item[aria-current="page"] .nav-ic { background: var(--ac); color: var(--ink); }
.nav-l { flex: 1; white-space: nowrap; }
.nav-badge {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-pill); display: grid; place-items: center;
  font-family: var(--font-num); font-size: 12px; font-weight: 600; background: var(--bad); color: var(--ink);
  direction: ltr; /* "99+" stays "99+" inside the RTL menu */
}
.nav-item[aria-current="page"] .nav-badge { background: #000; color: var(--text); }
.nav-dot {
  position: absolute; top: 8px; inset-inline-end: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--card); display: none;
}
.nav-more { color: var(--muted-2); font-size: 16px; }

/* Sidebar bottom: the current place card, settings, logout */
.sb-place { background: var(--card-2); border-radius: var(--r-tile); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sb-place-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pin-circle {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ac); color: var(--ink);
  display: grid; place-items: center; flex: none; text-decoration: none;
}
.pin-circle .ph-fill { font-size: 17px; }
.sb-place-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sb-place-name { font-size: var(--fs-ui); }
.sb-place-sub { font-size: var(--fs-small); color: var(--muted-2); }
.sb-change {
  height: 40px; border-radius: var(--r-pill); background: #000; color: var(--text); font-size: var(--fs-meta);
  display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.sb-change .ph { font-size: 15px; }
.sb-foot { display: flex; gap: 6px; padding-top: 10px; }
.sb-settings {
  flex: 1; height: 44px; border-radius: var(--r-pill); border: none; background: transparent; color: var(--muted);
  font-size: var(--fs-meta); display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.sb-settings:hover { color: var(--text); }
.sb-settings .ph { font-size: 18px; }
.sb-logout {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--card-2); color: var(--text);
  display: grid; place-items: center; flex: none;
}
.sb-logout .ph { font-size: 18px; }
.sb-thin-foot { display: none; flex-direction: column; align-items: center; gap: 8px; }
.sb-thin-foot .pin-circle { width: 44px; height: 44px; }
.sb-thin-foot .pin-circle .ph-fill { font-size: 18px; }
.sb-thin-foot .sb-settings { flex: none; width: 44px; padding: 0; border-radius: 50%; }
.sb-thin-foot .sb-settings .ph { font-size: 19px; }

/* Thin sidebar (84 px): icons only, badge becomes a dot */
.app[data-sb="thin"] .sb { width: var(--sb-thin); padding: 20px 14px 14px; }
.app[data-sb="thin"] .sb-top { flex-direction: column; }
.app[data-sb="thin"] .sb-brand,
.app[data-sb="thin"] .sb-label,
.app[data-sb="thin"] .nav-l,
.app[data-sb="thin"] .nav-badge,
.app[data-sb="thin"] .sb-place,
.app[data-sb="thin"] .sb-foot { display: none; }
.app[data-sb="thin"] .sb-thin-foot { display: flex; }
.app[data-sb="thin"] .sb .nav-item { padding: 0; justify-content: center; background: transparent; }
.app[data-sb="thin"] .sb .nav-item.has-badge .nav-dot { display: block; }

/* ---------- Desktop header ---------- */
.hdr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hdr-greet { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hdr-hello { font-size: var(--fs-meta); color: var(--muted-2); }
.hdr-title { font-size: 24px; }
.hdr-search {
  display: flex; align-items: center; gap: 10px; height: 52px; padding-block: 0; padding-inline: 6px 18px; margin: 0;
  border-radius: var(--r-pill); background: var(--card); min-width: 260px;
}
.hdr-search-ic {
  width: 40px; height: 40px; border-radius: 50%; background: var(--white); color: var(--ink);
  display: grid; place-items: center; flex: none; border: none; padding: 0;
}
.hdr-search-ic .ph { font-size: 18px; }
.hdr-search input {
  flex: 1; min-width: 0; border: none; background: transparent; font: inherit; font-size: var(--fs-ui);
  color: var(--text); outline: none;
}
.bell {
  position: relative; width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--white);
  color: var(--ink); display: grid; place-items: center; flex: none; text-decoration: none;
}
.bell:hover { color: var(--ink); }
.bell .ph { font-size: 20px; }
.bell-dot {
  position: absolute; top: 13px; inset-inline-end: 14px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ac); border: 1.5px solid var(--white); display: none;
}
.bell.has-unseen .bell-dot { display: block; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--ac); padding: 3px; flex: none;
  text-decoration: none; display: block;
}
.avatar span {
  width: 100%; height: 100%; border-radius: 50%; background: var(--card); color: var(--text);
  display: grid; place-items: center; font-size: 17px; font-weight: 600;
}
.avatar .ph { font-size: 20px; }
.hdr[data-mode="compact"] .hdr-greet,
.hdr[data-mode="compact"] .hdr-search { display: none; }

/* ---------- Phone top bar + tab bar (hidden on desktop) ---------- */
.ptop, .tabbar { display: none; }
.ptop-place {
  flex: 1; min-width: 0; height: 44px; border-radius: var(--r-pill); border: none; background: var(--card);
  color: var(--text); font-size: var(--fs-ui); display: flex; align-items: center; gap: 8px; padding: 0 14px;
  text-decoration: none;
}
.ptop-place:hover { color: var(--text); }
.ptop-place .ph-fill { font-size: 16px; color: var(--ac); flex: none; }
.ptop-place .ph { font-size: 14px; flex: none; }
.ptop-place-name { flex: 1; min-width: 0; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabbar-in { display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: var(--r-pill); background: var(--card); }
.tab {
  flex: 1 1 0; min-width: 44px; height: 50px; border-radius: var(--r-pill); border: none; background: transparent;
  color: var(--text); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-meta);
  white-space: nowrap; overflow: hidden; text-decoration: none; padding: 0;
  transition: flex-grow var(--t-tab) var(--ease), background var(--t-tab) var(--ease);
}
.tab:hover { color: var(--text); }
.tab .ph { font-size: 20px; flex: none; }
.tab-l { display: none; }
.tab[aria-current="page"] { flex-grow: 2.2; background: var(--white); color: var(--ink); }
.tab[aria-current="page"] .tab-l { display: inline; }
.tab[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ---------- Tablet: sidebar always thin, no toggle ---------- */
@media (min-width: 701px) and (max-width: 1099px) {
  .app[data-layout="app"] { gap: 16px; }
  .app[data-layout="app"] .sb-toggle { display: none; }
  .hdr-search { min-width: 200px; flex: 0 1 320px; }
}

/* ---------- Phone ---------- */
@media (max-width: 700px) {
  .app[data-layout="app"] { padding: 0; gap: 0; flex-direction: column; align-items: stretch; }
  .app[data-layout="app"] .sb,
  .app[data-layout="app"] .hdr { display: none; }
  .app[data-layout="app"] .main { gap: 12px; }
  .app[data-layout="app"] .ptop {
    display: flex; align-items: center; gap: 8px;
    padding: max(14px, env(safe-area-inset-top)) 14px 0;
  }
  .ptop .bell { width: 44px; height: 44px; }
  .ptop .bell .ph { font-size: 19px; }
  .ptop .bell-dot { top: 11px; inset-inline-end: 12px; }
  .app[data-layout="app"] .page { padding: 0 14px 18px; gap: 12px; }
  .app[data-layout="app"] .tabbar {
    display: block; position: sticky; bottom: 0; z-index: 20;
    padding: 8px 14px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, #000 70%, rgba(0, 0, 0, 0));
  }
}
@media (max-width: 700px) { .sb-change { height: 44px; } } /* «غيّر المكان» in the «المزيد» sheet */
/* Narrow phones: six 44 px tabs leave the open tab no room for its name (cut at 320 px, and «المراجعات» /
   "Dashboard" at 360 px). Under 390 px the tabs sit closer (36 px at least) and the open tab's name goes
   under its icon, so it is never cut. 390 px and wider: as before. */
@media (max-width: 389px) {
  .app[data-layout="app"] .tabbar { padding-inline: 10px; }
  .tabbar-in { gap: 2px; padding: 4px; }
  .tab { min-width: 36px; }
  .tab[aria-current="page"] { flex-direction: column; gap: 2px; }
  .tab[aria-current="page"] .tab-l { font-size: var(--fs-small); line-height: 1.2; }
}
/* English: the top bar's place pill a little tighter under 390 px, so "Pick a place" shows whole at 360 px like
   «اختر مكانك» (Arabic as before) */
@media (max-width: 389px) {
  :root[dir="ltr"] .ptop-place { padding: 0 10px; gap: 6px; }
}
