/* Shared components: dialogs, action overlay, header, menu rows,
   avatars, pickers. Measurements follow mobile's StyleSheets. */

/* ── Dialog (mobile components/ui/dialog.tsx) ──────────────────────── */
#layers > * {
  position: fixed;
  inset: 0;
}
.dialog-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  z-index: 100;
  animation: fade-in 120ms ease-out;
}
.dialog-card {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--accent-border);
  padding: 20px;
  outline: none;
  scrollbar-width: none;
}
.dialog-card::-webkit-scrollbar { display: none; }
.dialog-card--menu { padding: 8px; }
.dialog-card--wide { max-width: 640px; }
.dialog-card--tall { min-height: min(560px, 80vh); }
.dialog-card--appearance { height: min(620px, 70vh); display: flex; flex-direction: column; }
.dialog-card--crop { max-width: 380px; }
.dialog-card--alert { max-width: 380px; }
.dialog-bare {
  outline: none;
}
.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.dialog-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.45;
  white-space: pre-line;
}
.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.dialog-actions > .btn { flex: 1; }
.dialog-actions--stacked { flex-direction: column; }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form .dialog-title { margin-bottom: 4px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  margin-top: 4px;
  cursor: pointer;
}

/* ── Action overlay (mobile action-overlay.tsx) ─────────────────────── */
.overlay-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--overlay-backdrop) 60%, transparent);
  z-index: 200;
}
.overlay-card {
  min-width: 180px;
  max-width: 320px;
  border-radius: 16px;
  border: 1px solid var(--accent-border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.overlay-label {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.overlay-reason {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}
.overlay-circle {
  width: 52px;
  height: 52px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay-circle .mdi { color: var(--white); }
.overlay-circle--success { background: var(--success); }
.overlay-circle--error { background: var(--danger); }

/* ── Screen header (mobile screen-header.tsx) ──────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 6px 16px;
  gap: 8px;
  flex-shrink: 0;
}
.screen-header__side {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.screen-header__side--right { justify-content: flex-end; }
.screen-header__title {
  flex: 0 1 auto;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back-button {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px 4px 0;
  color: var(--accent);
  font-size: 17px;
}
.back-button .mdi { margin-right: -2px; }

/* eHQ logo button (mobile NotificationLogoButton: 48px, radius 10). */
.logo-button {
  position: relative;
  flex-shrink: 0;
}
.logo-button__img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--accent-border);
}

/* ── Menu row (mobile menu-row.tsx) ─────────────────────────────────── */
.menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  border-radius: 0;
}
.menu-row--no-border { border-bottom: 0; }
.menu-row--disabled { opacity: 0.6; }
.menu-row__text { flex: 1; display: flex; flex-direction: column; }
.menu-row__label { font-size: 16px; font-weight: 600; color: var(--text); }
.menu-row__subtitle { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.list-row--no-border { border-bottom: 0; }
.list-row__label { font-size: 15px; font-weight: 600; }

/* ── Square avatar (mobile square-avatar.tsx) ──────────────────────── */
.square-avatar {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.square-avatar--no-border { border: 0; }
.square-avatar--gradient { background: linear-gradient(to bottom, var(--background), var(--accent)); }
.square-avatar--plain { background: var(--background); }
.square-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.square-avatar__img--contain { object-fit: contain; }
.square-avatar__placeholder { width: 50%; height: 50%; object-fit: contain; }
/* Default person / group glyphs, tinted to the accent colour via a mask
   (the web equivalent of mobile's Image tintColor). */
.square-avatar__glyph {
  background-color: var(--accent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.square-avatar__glyph--user {
  width: 70%;
  height: 70%;
  -webkit-mask-image: url('/assets/images/default.png');
  mask-image: url('/assets/images/default.png');
}
.square-avatar__glyph--group {
  width: 85%;
  height: 85%;
  -webkit-mask-image: url('/assets/images/default-groupchat.png');
  mask-image: url('/assets/images/default-groupchat.png');
}

/* ── Avatar menu / default avatar grid ─────────────────────────────── */
.avatar-menu { display: flex; flex-direction: column; border-radius: 12px; }
.avatar-menu--drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.avatar-menu__hint {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 2px 0 6px;
}
.default-avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: none;
}
.default-avatar-grid__tile {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--accent-border);
  background: linear-gradient(to bottom, var(--background), var(--accent));
}
.default-avatar-grid__tile img { width: 100%; height: 100%; object-fit: contain; }

/* ── Crop / webcam ─────────────────────────────────────────────────── */
.crop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.crop__viewport {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: var(--surface-alt);
  cursor: grab;
  touch-action: none;
  max-width: 100%;
}
.crop__viewport:active { cursor: grabbing; }
.crop__image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  pointer-events: none;
}
.crop__slider { width: 100%; accent-color: var(--accent); }
.webcam { border-radius: 12px; overflow: hidden; background: var(--surface-alt); }
.webcam__video { display: block; width: 100%; transform: scaleX(-1); }

/* ── Thumbnail grid (gallery picker) ───────────────────────────────── */
.gallery-picker__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gallery-picker__head .dialog-title { margin: 0; }
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.thumb-grid__tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.thumb-grid__img { width: 100%; height: 100%; object-fit: cover; }
.thumb-grid__busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--overlay-backdrop) 50%, transparent);
}

/* ── Segmented control (Appearance's Light/Dark/Auto) ──────────────── */
.segmented {
  display: flex;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}
.segmented__option {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.segmented__option--active { background: var(--accent); color: var(--on-accent); }

/* ── Action menu (2026-09-29) ──────────────────────────────────────── */
.action-menu { display: flex; flex-direction: column; }
.action-menu__row { display: flex; align-items: center; gap: 14px; padding: 13px 6px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; text-align: left; width: 100%; border-radius: 0; }
.action-menu__row:last-child { border-bottom: 0; }
.action-menu__row--danger { color: var(--danger); }
