/*
 * A meeting room's New Link and Password (TINL-1476, docs/meet-links.md): the one sheet (#ml-modal, js/meet-link.js),
 * the password field before joining a room, and the host's part of a room's Invite dialog. Tokens only, so it follows
 * Light and Dark (a meeting room is always dark). On phones the sheet is the .modal bottom sheet of style.css: here it
 * keeps its main button above the keyboard (the body scrolls, the height follows the visible part of the screen).
 */

/* ---------- The sheet ---------- */
.ml-modal { max-width: 480px; }
.ml-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; padding-right: 40px; }
.ml-head .icon-chip { flex-shrink: 0; }
.ml-head h2 { margin: 0 0 4px; font-size: var(--fs-2xl); line-height: 1.2; }
.ml-head p { margin: 0; color: var(--text-light); font-size: var(--fs-sm); line-height: 1.5; }
.ml-text { margin: 0 0 14px; color: var(--text-secondary); line-height: 1.55; }
.ml-current { display: grid; gap: 4px; margin: 0 0 6px; font-size: var(--fs-xs); color: var(--text-light); }
.ml-current code {
  display: block; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-light); background: var(--bg-subtle);
  color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ml-label { display: block; margin: 4px 0 6px; font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.ml-input { width: 100%; min-height: 48px; font-size: 16px; }
.ml-mono { font-family: var(--font-mono); font-size: 15px; text-overflow: ellipsis; }
.ml-passrow { display: flex; gap: 8px; align-items: stretch; }
.ml-passrow .ml-input { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); letter-spacing: 0.04em; }
.ml-icon-btn { width: 48px; min-width: 48px; min-height: 48px; padding: 0; display: inline-grid; place-items: center; flex-shrink: 0; }
.ml-hint { margin: 6px 0 0; color: var(--text-light); font-size: var(--fs-xs); }
.ml-error { margin: 10px 0 0; color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
.ml-error[hidden] { display: none; }
.ml-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.ml-actions .btn { min-height: 44px; }
.ml-remove {
  display: block; margin: 16px auto 0; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  color: var(--danger); font: 600 var(--fs-sm)/1 inherit; cursor: pointer; transition: background var(--dur-fast) ease;
}
.ml-remove:hover, .ml-remove.is-armed { background: var(--danger-bg); }
.ml-remove:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
@media (max-width: 640px) {
  /* the keyboard takes the bottom of the screen: the sheet follows the visible height, its body scrolls */
  .ml-modal { max-height: min(92vh, 92dvh); }
  .ml-actions { flex-direction: column; }
  .ml-actions .btn { width: 100%; min-height: 48px; }
  .ml-head .icon-chip { display: none; }
  .ml-head { padding-right: 44px; }
  /* a toast ("Copied", "New link made") never covers the sheet's buttons: while the sheet is open it shows at the top */
  body:has(#ml-modal.active) .toast-stack { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; }
}

/* ---------- A room: the password before joining ---------- */
.mt-pass-row { display: grid; gap: 6px; margin-top: 4px; }
.mt-pass-row.hidden { display: none; }
.mt-pass-row .mt-input { font-family: var(--font-mono); letter-spacing: 0.04em; }
.mt-pass-hint { margin: 0; color: var(--text-light); font-size: var(--fs-xs); }
.mt-pass-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
.mt-pass-error.hidden { display: none; }

/* ---------- A room: the host's part of the Invite dialog ---------- */
.mt-invite-nolink { margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--bg-subtle); color: var(--text-secondary); font-size: var(--fs-sm); }
.mt-invite-nolink.hidden, .mt-invite-host.hidden { display: none; }
.mt-invite-host { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.mt-invite-passrow { display: flex; gap: 8px; align-items: stretch; }
.mt-invite-passrow input { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-weight: 600; }
.mt-invite-passrow .ml-icon-btn { width: 44px; min-width: 44px; min-height: 44px; }
.mt-invite-nopass { margin: 0; padding: 10px 0; color: var(--text-light); font-size: var(--fs-sm); }
.mt-invite-hostbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mt-invite-hostbtns .btn { min-height: 44px; white-space: normal; line-height: 1.2; justify-content: center; }
/* a finger-sized tap area on every button of the Invite dialog (touch screens) */
@media (pointer: coarse) { #mt-invite-modal .btn { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .ml-remove { transition: none; } }
