/* sheet.css — the overlay sheet (compose, groups, dialogs), Quick Look, toasts, fields. */

body.no-scroll { overflow: hidden; }
@keyframes sheetUp  { from { transform: translateY(40px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }

.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .2s var(--ease) both;
}
.overlay.is-closing { animation: fadeIn .2s var(--ease) reverse both; }
.sheet {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: sheetUp .38s var(--spring) both;
}
.overlay.is-closing .sheet { animation: sheetUp .2s var(--ease) reverse both; }
.sheet--sm { max-width: 400px; }
.sheet--lg { max-width: 640px; }
.sheet--look { max-width: 1000px; height: calc(100vh - 48px); }
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
}
.sheet-head > :last-child { justify-self: end; }
.sheet-title { font-size: 16px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.sheet-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.sheet-text { color: var(--label-2); }
.link-btn { justify-self: start; background: none; border: none; color: var(--accent); font-size: 16px; cursor: pointer; padding: 2px 0; }
.link-btn:hover { opacity: .75; }
.link-btn--strong { font-weight: 600; }
.link-btn.is-danger { color: var(--red); }
.link-btn:disabled { opacity: .4; cursor: default; }

/* ── Fields ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--label-2); }
.field input, .search input, .compose-title, .compose-body {
  width: 100%; border: 1px solid transparent; outline: none;
  background: var(--surface-2); border-radius: var(--r-md); padding: 11px 14px; font-size: 16px; color: var(--label);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .search input:focus, .compose-title:focus, .compose-body:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-light); background: var(--surface);
}
.search { position: relative; display: block; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--label-3); }
.search input { padding-left: 36px; font-size: 15px; }

/* Group member checkboxes: a checkmark on the right, like iOS. */
.row--check { padding: 9px 14px; }
.row--check input { position: absolute; opacity: 0; pointer-events: none; }
.check { display: flex; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--label-3); align-items: center; justify-content: center; color: transparent; transition: all .15s; }
.check svg { width: 14px; height: 14px; stroke-width: 2.6; }
.row--check input:checked + .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.row--check input:focus-visible + .check { outline: 2px solid var(--accent); outline-offset: 2px; }
.list--inset .row + .row::before { left: 56px; }

/* ── Compose ───────────────────────────────────────────────────────── */
.to { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0 12px; border-bottom: 1px solid var(--border-2); }
.to-label { color: var(--label-2); margin-right: 2px; }
.to-chips { display: contents; }
.to-input { flex: 1; min-width: 160px; border: none; background: none; outline: none; font-size: 16px; padding: 4px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 11px; border-radius: var(--r-full);
  background: var(--accent-light); color: var(--accent); border: none; font-size: 14px; font-weight: 600; cursor: pointer;
  animation: scaleIn .25s var(--spring) both;
}
.chip svg { width: 13px; height: 13px; opacity: .7; }
.chip:hover svg { opacity: 1; }
.to-menu {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin-top: 4px; padding: 5px;
  max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: scaleIn .15s var(--ease) both; transform-origin: top;
}
.to-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 9px; border: none; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.to-opt:hover, .to-opt.is-on:not(:hover):first-child { background: var(--surface-2); }
.compose-title { font-weight: 600; }
.compose-body { resize: vertical; min-height: 150px; line-height: 1.5; }
.dropzone { display: flex; flex-direction: column; gap: 10px; border-radius: var(--r-md); transition: background .15s, box-shadow .15s; }
.dropzone.is-drop { background: var(--accent-light); box-shadow: 0 0 0 2px var(--accent); }
.dropzone-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 16px; border: 1.5px dashed var(--border); border-radius: var(--r-md); background: none; cursor: pointer;
  color: var(--accent); font-weight: 600; transition: border-color .15s, background .15s;
}
.dropzone-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.dropzone-btn svg { width: 18px; height: 18px; }
.dropzone-btn small { color: var(--label-3); font-weight: 400; font-size: 13px; }
.attach-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }

/* Choose from Files: folders are buttons, files are tick rows. */
.picker .crumbs { margin-bottom: 10px; }
.picker .crumbs b { color: var(--label); font-weight: 600; }
.crumb { background: none; border: none; padding: 0; cursor: pointer; color: var(--accent); font-weight: 500; }
.crumb:hover { opacity: .75; }
button.row { width: 100%; border: none; background: none; text-align: left; color: inherit; }

/* ── Quick Look ────────────────────────────────────────────────────── */
.sheet--look .sheet-body { padding: 0; gap: 0; background: var(--surface-2); }
.look { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.look img, .look video { max-width: 100%; max-height: 100%; object-fit: contain; }
.look iframe { width: 100%; height: 100%; border: none; background: #fff; }
.look-foot { display: flex; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border-2); background: var(--surface); }

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translateX(-50%);
  padding: 11px 20px; border-radius: var(--r-full); font-size: 14px; font-weight: 500;
  background: color-mix(in srgb, var(--label) 88%, transparent); color: var(--bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow-lg);
  animation: sheetUp .35s var(--spring) both;
}
.toast.is-closing { animation: fadeIn .3s var(--ease) reverse both; }
