/* Application shell: green sidebar (tablet and desktop), top bar, drawer and bottom bar (mobile). */
.shell { min-height: 100vh; display: flex; }
.sidebar {
  position: sticky; top: 0; height: 100vh; flex: none;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary), var(--primary-deep));
  color: #fff; display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
}
.sidebar::before { /* very light 8-point star pattern, as in the app */
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .05;
  background-image: url('/assets/pattern.svg'); background-size: 64px 64px;
}
.sidebar .brand { padding: 22px 20px 16px; }
/* the full name on one line in the side menu (it wraps only in languages where it is still too long) */
.sidebar .brand-lockup .ar { font-size: var(--fs-lg); }
.sidebar .brand-lockup .en { font-size: 11px; letter-spacing: .3px; }
.sidebar .place {
  margin: 0 20px 12px; padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .10); border-radius: var(--radius-control);
  font-weight: 600; font-size: var(--fs-sm);
}
.sidebar .place .icon { color: var(--accent); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 14px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.side-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; margin: 2px 0; border: 0; border-radius: var(--radius-control);
  background: transparent; color: rgba(255, 255, 255, .86); text-align: start; font-weight: 500; font-size: var(--fs-md);
  text-decoration: none;
}
.side-item:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.side-item .icon { color: rgba(255, 255, 255, .7); }
.side-item[aria-current="page"] { background: #fff; color: var(--primary); font-weight: 700; }
.side-item[aria-current="page"] .icon { color: var(--primary); }
.side-item[aria-current="page"]::after { content: ''; margin-inline-start: auto; width: 4px; height: 18px; border-radius: 4px; background: var(--accent); }
.side-item .count { margin-inline-start: auto; }
.side-group { padding: 18px 10px 6px; font-size: var(--fs-xs); font-weight: 700; color: rgba(255, 255, 255, .55); }
.sidebar .me {
  margin: 14px; padding: 10px; display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, .14); border-radius: var(--radius-control);
}
.sidebar .me .who { min-width: 0; flex: 1; }
.sidebar .me .name { font-weight: 600; font-size: var(--fs-sm); }
.sidebar .me .role { font-size: var(--fs-xs); color: rgba(255, 255, 255, .6); }
.sidebar .icon-btn { color: rgba(255, 255, 255, .75); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-xl);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .where { flex: 1; min-width: 0; }
.topbar .where .place { font-weight: 600; font-family: var(--font-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .where .ws { font-size: var(--fs-xs); color: var(--tone-warning-fg); font-weight: 700; }
.topbar .user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-control); color: var(--text); }
.topbar .user:hover { background: var(--surface-alt); text-decoration: none; }
.topbar .user .name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; }
.topbar .user .role { font-size: var(--fs-xs); color: var(--text-muted); }
.topbar .menu-btn { display: none; }

.content { flex: 1; padding: 0 var(--space-xl) var(--space-xxl); }
.content.with-bottombar { padding-bottom: calc(var(--bottombar-h) + var(--space-xl)); }
.container { width: 100%; max-width: var(--content-max); margin-inline: auto; }

/* page header */
.page-header { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xl) 0 var(--space-md); flex-wrap: wrap; }
.page-header .titles { flex: 1; min-width: 200px; }
.page-header h1 { font-size: var(--fs-xxl); }
.page-header .subtitle { color: var(--text-muted); margin-top: 2px; }
.page-header .actions { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.page-body { display: flex; flex-direction: column; gap: var(--space-md); }
.page-body.fab-space { padding-bottom: 72px; }
.tabs-bar { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: var(--space-md); scrollbar-width: none; }
.tabs-bar button {
  border: 0; background: transparent; padding: 10px 14px; color: var(--text-muted); font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 6px;
}
.tabs-bar button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

/* mobile: drawer and bottom bar */
.bottombar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: var(--bottombar-h);
  display: none; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottombar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: 11px; font-weight: 600; text-decoration: none; position: relative; min-width: 0;
}
.bottombar a span.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.bottombar a[aria-current="page"] { color: var(--primary); }
.bottombar a[aria-current="page"] .pill { background: var(--primary-soft); }
.bottombar .pill { padding: 4px 16px; border-radius: var(--radius-pill); display: grid; place-items: center; position: relative; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 40; }
.shell.drawer-open .sidebar { transform: translateX(0); }

@media (max-width: 1079.98px) {
  .sidebar { width: var(--sidebar-compact-w); }
  .sidebar .brand .words, .sidebar .place, .sidebar .side-group, .sidebar .me .who, .sidebar .me .avatar { display: none; }
  .sidebar .brand { padding: 22px 8px 16px; display: grid; place-items: center; }
  .sidebar nav { padding: 4px 10px; }
  .side-item { flex-direction: column; gap: 4px; padding: 10px 2px; font-size: 10.5px; text-align: center; }
  .side-item span.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-item[aria-current="page"]::after { display: none; }
  .side-item .count { position: absolute; margin: 0; transform: translate(-14px, -6px); }
  .sidebar .me { margin: 10px; padding: 6px; justify-content: center; }
}
@media (max-width: 719.98px) {
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: 300px; height: 100%;
    transform: translateX(100%); transition: transform .2s ease;
  }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .shell.drawer-open .sidebar, [dir="ltr"] .shell.drawer-open .sidebar { transform: translateX(0); }
  /* the drawer shows the full sidebar */
  .sidebar .brand .words, .sidebar .place, .sidebar .side-group, .sidebar .me .who, .sidebar .me .avatar { display: revert; }
  .sidebar .brand { padding: 22px 20px 16px; display: block; }
  .sidebar nav { padding: 4px 14px; }
  .side-item { flex-direction: row; gap: 12px; padding: 11px 12px; font-size: var(--fs-md); text-align: start; }
  .side-item .count { position: static; margin-inline-start: auto; transform: none; }
  .sidebar .me { margin: 14px; padding: 10px; justify-content: flex-start; }
  .topbar { padding: 0 var(--space-sm); }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .user .who { display: none; }
  .content { padding: 0 var(--space-md) var(--space-xl); }
  .bottombar.show { display: flex; }
  .page-header { padding: var(--space-md) 0 var(--space-sm); }
  .page-header h1 { font-size: var(--fs-xl); }
}

/* public pages (login, registration) */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--background); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; isolation: isolate;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  padding: var(--space-xxxl); display: flex; flex-direction: column; justify-content: center; gap: var(--space-lg);
}
.auth-hero::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .07; background-image: url('/assets/pattern.svg'); background-size: 56px 56px; }
.auth-hero::after { content: ''; position: absolute; inset-inline-start: 0; bottom: 0; width: 320px; height: 160px; z-index: -1; background: url('/assets/mosque.svg') no-repeat bottom / contain; opacity: .9; }
.auth-hero h2 { font-size: var(--fs-hero); }
.auth-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-hero li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, .88); }
.auth-hero li .icon { color: var(--accent); }
.auth-side { display: grid; place-items: center; padding: var(--space-xl) var(--space-md); }
.auth-card { width: 100%; max-width: 460px; }
.auth-card.wide { max-width: 640px; }
@media (min-width: 1000px) {
  .auth-page { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 999.98px) {
  .auth-hero { display: none; }
  .auth-page { background: linear-gradient(180deg, var(--primary) 0, var(--primary-deep) 220px, var(--background) 220px); }
}
.async-view { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; }
