/* Shared UI for the signed-in pages: account menu, forms, cards, lists, dialogs (Qatar maroon theme). */

.app[hidden] { display: none; }
.headline [data-i18n='voice.headline'] { white-space: pre-line; }

/* ---------- Top-right account controls (all pages) ---------- */
.topbar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #ffffff1f;
  background: #ffffff0d;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.pill-btn:hover { border-color: var(--maroon-glow); }
.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #d06a9266;
  background: radial-gradient(circle at 30% 30%, var(--maroon-glow), var(--maroon) 60%, var(--maroon-deep));
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 18px #8a153855;
}
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border-radius: 14px;
  background: #160811f2;
  border: 1px solid #a3244c55;
  box-shadow: 0 18px 40px #000a;
  backdrop-filter: blur(10px);
}
.menu-head { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid #ffffff14; margin-bottom: 4px; }
.menu-head span { font-size: 0.8rem; color: var(--muted); direction: ltr; text-align: start; unicode-bidi: plaintext; }
.menu-links { display: grid; }
.menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: #8a153840; outline: none; }
.menu-item[aria-current='page'] { color: #f3cddb; background: #8a153826; }
.menu-item.danger { color: #ffb3c4; margin-top: 4px; border-top: 1px solid #ffffff10; border-radius: 0 0 9px 9px; }

/* ---------- Page layout (login, profile, users, roles) ---------- */
body.page { overflow: auto; }
.page-wrap {
  position: relative;
  max-width: 920px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(80px, calc(env(safe-area-inset-top) + 70px)) 18px 40px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; }

.card {
  background: linear-gradient(160deg, #1a0a12e6, #0e050ae6);
  border: 1px solid #ffffff14;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px #0006;
}
.card h2 { margin: 0 0 14px; font-size: 1.1rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.85rem; color: var(--muted); }
.input, .select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #ffffff22;
  background: #0b0408;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.input:focus, .select:focus { outline: none; border-color: var(--maroon-glow); box-shadow: 0 0 0 3px #a3244c33; }
.input[readonly] { color: var(--muted); }
.ltr { direction: ltr; text-align: left; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--maroon-glow); }

.password-wrap { position: relative; direction: ltr; }
.password-wrap .input { padding-inline-end: 46px; }
.eye-btn {
  position: absolute;
  inset-inline-end: 6px;
  top: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.eye-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--maroon-glow), var(--maroon));
  box-shadow: 0 6px 18px #8a153855;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost { background: #ffffff0d; border-color: #ffffff22; box-shadow: none; color: var(--text); }
.btn.danger { background: #3a0712; border-color: #ff9db055; color: #ffc2cf; box-shadow: none; }
.btn.small { height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.notice {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  background: #3a0712cc;
  border: 1px solid #ff9db055;
  color: #ffd4dd;
}
.notice.ok { background: #0f2a1acc; border-color: #7fd6a055; color: #c9f3d8; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 90px 18px 40px;
}
.login-card { width: min(420px, 100%); }
@media (orientation: landscape) and (max-height: 560px) {
  .login-wrap { padding-top: 70px; }
  .login-logo { height: 60px; margin-bottom: 8px; }
}
.login-logo { display: block; height: 92px; width: auto; margin: 0 auto 14px; filter: invert(1) sepia(0.35) saturate(2) hue-rotate(295deg) brightness(0.95); mix-blend-mode: screen; }
.login-card h1 { margin: 0 0 4px; text-align: center; font-size: 1.7rem; font-weight: 800; }
.login-card p.sub { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.login-card .btn { width: 100%; }
.page-logo {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  height: 46px;
  width: auto;
  filter: invert(1) sepia(0.35) saturate(2) hue-rotate(295deg) brightness(0.95);
  mix-blend-mode: screen;
  opacity: 0.9;
}

/* ---------- Lists (users, roles) ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 220px; }
.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  background: #ffffff08;
  border: 1px solid #ffffff12;
}
.row .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: radial-gradient(circle at 30% 30%, #a3244c, #4a0b1e);
}
.row .main { min-width: 0; display: grid; gap: 4px; }
.row .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 0.82rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #8a153833;
  border: 1px solid #a3244c55;
  color: #f3cddb;
}
.tag.off { background: #ffffff0a; border-color: #ffffff22; color: var(--muted); }
.tag.warn { background: #4a2a0733; border-color: #e0a85a66; color: #ffd9a8; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

@media (max-width: 560px) {
  .row { grid-template-columns: auto 1fr; }
  .row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- Permission checkboxes ---------- */
.perm-group { border: 1px solid #ffffff14; border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; margin: 0; }
.perm-group legend { padding: 0 6px; font-size: 0.85rem; color: var(--muted); }
.perm-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-tags.spaced { margin-top: 8px; }

/* ---------- Install-the-app banner (all pages) ---------- */
.install-banner {
  position: fixed;
  z-index: 40;
  top: calc(max(16px, env(safe-area-inset-top)) + 50px);
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #160811f2;
  border: 1px solid #a3244c66;
  box-shadow: 0 18px 40px #000b;
  backdrop-filter: blur(10px);
  animation: install-in 0.3s ease-out;
}
.install-banner[hidden], .install-banner [hidden] { display: none; }
.install-banner img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.install-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.install-text strong { font-size: 0.95rem; }
.install-text span { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.install-actions { display: flex; gap: 6px; flex: none; }
@keyframes install-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@media (max-width: 420px) {
  .install-banner { flex-wrap: wrap; }
  .install-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Dialog ---------- */
dialog.sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid #a3244c55;
  border-radius: 18px;
  background: #12060d;
  color: var(--text);
  box-shadow: 0 30px 80px #000c;
}
dialog.sheet::backdrop { background: #05010399; backdrop-filter: blur(3px); }
dialog.sheet form { padding: 20px; }
dialog.sheet h2 { margin: 0 0 16px; font-size: 1.2rem; }
