html.ea-open, html.ea-open body { overflow: hidden; }

[data-memory-type][data-memory-id] { cursor: pointer; }
[data-memory-type][data-memory-id]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent, #2677ff) 55%, transparent); outline-offset: 3px; }

.ea-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1190;
  border: 0;
  background: rgba(9, 15, 28, .48);
  backdrop-filter: blur(10px);
}

.ea-sheet {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: 18px;
  width: min(680px, calc(100vw - 28px));
  max-height: min(78vh, 760px);
  transform: translateX(-50%);
  overflow: auto;
  border: 1px solid rgba(142, 164, 207, .24);
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface, #fff) 96%, transparent);
  box-shadow: 0 28px 90px rgba(15, 25, 48, .28);
  padding: 18px;
}

.ea-handle { display: none; width: 46px; height: 4px; border-radius: 999px; background: rgba(120, 133, 158, .35); margin: 0 auto 10px; }
.ea-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ea-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #737c91); }
.ea-close { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 4px 8px; color: inherit; cursor: pointer; }
.ea-title { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0 14px; }
.ea-title > span { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; background: color-mix(in srgb, var(--accent, #2677ff) 12%, transparent); font-size: 22px; }
.ea-title small { display: block; color: var(--muted, #737c91); margin-bottom: 2px; }
.ea-title h2 { margin: 0; font-size: clamp(20px, 4vw, 28px); line-height: 1.15; }
.ea-title p { margin: 7px 0 0; color: var(--muted, #737c91); font-size: 13px; }
.ea-info { display: grid; gap: 8px; margin: 4px 0 16px; }
.ea-info-row { display: grid; grid-template-columns: minmax(110px, .55fr) minmax(0, 1.45fr); gap: 12px; align-items: start; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--surface-2, #f3f6fb) 82%, transparent); }
.ea-info-row span { color: var(--muted, #737c91); font-size: 12px; }
.ea-info-row b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ea-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ea-actions button { min-height: 44px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--border, #dfe5ef) 85%, transparent); background: color-mix(in srgb, var(--surface-2, #f4f7fb) 82%, transparent); color: inherit; font: inherit; font-weight: 650; cursor: pointer; }
.ea-actions .ea-primary { background: var(--accent, #2677ff); border-color: var(--accent, #2677ff); color: #fff; }
.ea-actions .ea-danger { color: #c9344c; }
.ea-actions button:disabled { opacity: .55; cursor: wait; }
.ea-status { min-height: 18px; margin: 10px 2px 0; color: var(--muted, #737c91); font-size: 13px; }
.ea-related { display: grid; gap: 8px; margin: 6px 0 16px; }
.ea-related > strong { font-size: 13px; }
.ea-related > button { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; text-align: left; border: 1px solid color-mix(in srgb, var(--border, #dfe5ef) 78%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface-2, #f4f7fb) 78%, transparent); color: inherit; padding: 10px 12px; cursor: pointer; }
.ea-related b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mo-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mo-distinct { border: 1px solid rgba(126, 144, 179, .34); background: transparent; color: inherit; border-radius: 12px; padding: 8px 11px; cursor: pointer; }
.mo-distinct:hover { background: rgba(127, 146, 185, .08); }

@media (max-width: 720px) {
  .ea-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 86dvh;
    transform: none;
    border-radius: 24px 24px 0 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .ea-handle { display: block; }
  .ea-actions { grid-template-columns: 1fr 1fr; }
  .ea-actions button { min-height: 50px; }
  .ea-info-row { grid-template-columns: 1fr; gap: 4px; }
  .mo-card-actions { width: 100%; justify-content: stretch; }
  .mo-card-actions button { flex: 1; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .ea-backdrop { backdrop-filter: none; }
}