/* One safe-area source for every app surface. The custom properties also let
   the browser tests exercise a real iPhone-style cutout on non-iOS runners. */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  touch-action: pan-x pan-y;
  overflow-x: clip;
  scrollbar-width: none;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

@media (display-mode: standalone) {
  #install-card {
    display: none !important;
  }
}

.onboarding-dialog {
  width: min(520px, calc(100% - 24px));
}

.onboarding-shell {
  padding-top: 34px;
}

.onboarding-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 22px;
  border-radius: 19px;
  background: linear-gradient(145deg, #102b5c, #071a3d);
  box-shadow: 0 12px 30px rgba(8, 29, 67, 0.22);
  color: #d7b979;
  font-size: 28px;
  font-weight: 800;
}

.onboarding-dialog[data-kind="notifications"] .onboarding-icon {
  background: linear-gradient(145deg, #f4e5bd, #d8b66d);
  color: #0b2654;
}

.onboarding-steps {
  display: grid;
  gap: 10px;
  margin: 22px 0 24px;
  padding: 0;
  list-style: none;
  counter-reset: onboarding-step;
}

.onboarding-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  counter-increment: onboarding-step;
}

.onboarding-steps li::before {
  content: counter(onboarding-step);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3ead6;
  color: #80672f;
  font-size: 12px;
  font-weight: 850;
}

.onboarding-actions {
  margin-top: 22px;
}

.onboarding-trust {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 600px) {
  .onboarding-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - var(--safe-top) - 12px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }

  .onboarding-shell {
    padding: 28px 20px calc(20px + var(--safe-bottom));
  }

  .onboarding-shell > h2 {
    font-size: 30px;
  }

  .onboarding-actions {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  }
}

/* Comfortable pointer and touch target for the compact agenda action. */
.agenda-block header a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-inline: 4px;
}

.share-fallback {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.share-fallback label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.share-fallback textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font: 14px/1.6 inherit;
}

.share-fallback button {
  margin-top: 10px;
}

.app-dialog {
  overflow: hidden;
}

.dialog-shell {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.notes-workspace,
.notes-workspace label,
.notes-workspace select,
.notes-workspace textarea {
  min-width: 0;
  max-width: 100%;
}

.notes-workspace select,
.notes-workspace textarea {
  width: 100%;
}

.notification-card > span {
  background: #eaf7f1;
  color: #16724d;
  font-size: 14px;
}

.panel button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

html.dialog-open,
html.dialog-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

html.dialog-open body {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
}

@media (max-width: 760px) {
  .topbar {
    height: calc(68px + var(--safe-top));
    padding: var(--safe-top) calc(18px + var(--safe-right)) 0 calc(18px + var(--safe-left));
  }

  .announcement {
    top: calc(68px + var(--safe-top));
  }

  .workspace,
  .view-screen {
    padding-bottom: calc(106px + var(--safe-bottom));
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .bottom-nav {
    right: calc(12px + var(--safe-right));
    bottom: max(12px, var(--safe-bottom));
    left: calc(12px + var(--safe-left));
    z-index: 1000;
    isolation: isolate;
    pointer-events: auto;
  }

  .toast {
    bottom: calc(96px + var(--safe-bottom));
    max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 32px);
  }

  .app-dialog:not(.dua-dialog) {
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  }

  .bottom-nav a {
    pointer-events: auto;
    touch-action: manipulation;
  }

  .dua-dialog {
    inset: 0;
    width: 100vw;
    width: 100dvw;
    max-width: 100vw;
    max-width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box;
  }

  .dua-dialog .dialog-shell {
    height: 100%;
    max-height: none;
    padding: calc(64px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(20px + var(--safe-left));
  }

  .dua-dialog .dialog-close {
    top: calc(12px + var(--safe-top));
    right: calc(16px + var(--safe-right));
    z-index: 2;
  }

  .admin-topbar {
    height: calc(72px + var(--safe-top));
    padding-top: var(--safe-top);
    padding-right: calc(14px + var(--safe-right));
    padding-left: calc(14px + var(--safe-left));
  }

  body:has(.admin-topbar) main {
    padding-bottom: calc(100px + var(--safe-bottom));
  }

  .dua-detail .arabic {
    margin-block: 16px;
    padding: 18px;
    font-size: clamp(26px, 8vw, 34px);
    line-height: 1.75;
  }
}

